Skip to content

Commit bb625c8

Browse files
chore: remove instances of deprecated subnetType enums (#20183)
---- ### All Submissions: * [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md) ### Adding new Unconventional Dependencies: * [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies) ### New Features * [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)? * [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)? *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
1 parent 765f441 commit bb625c8

File tree

44 files changed

+76
-76
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+76
-76
lines changed

packages/@aws-cdk/aws-apigatewayv2/lib/http/vpc-link.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export class VpcLink extends Resource implements IVpcLink {
9999

100100
this.vpcLinkId = cfnResource.ref;
101101

102-
const { subnets } = props.vpc.selectSubnets(props.subnets ?? { subnetType: ec2.SubnetType.PRIVATE });
102+
const { subnets } = props.vpc.selectSubnets(props.subnets ?? { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT });
103103
this.addSubnets(...subnets);
104104

105105
if (props.securityGroups) {

packages/@aws-cdk/aws-appsync/test/appsync-rds.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ describe('Rds Data Source configuration', () => {
3636
credentials: { username: 'clusteradmin' },
3737
clusterIdentifier: 'db-endpoint-test',
3838
vpc,
39-
vpcSubnets: { subnetType: SubnetType.PRIVATE },
39+
vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_NAT },
4040
securityGroups: [securityGroup],
4141
defaultDatabaseName: 'Animals',
4242
});
@@ -235,7 +235,7 @@ describe('adding rds data source from imported api', () => {
235235
credentials: { username: 'clusteradmin' },
236236
clusterIdentifier: 'db-endpoint-test',
237237
vpc,
238-
vpcSubnets: { subnetType: SubnetType.PRIVATE },
238+
vpcSubnets: { subnetType: SubnetType.PRIVATE_WITH_NAT },
239239
securityGroups: [securityGroup],
240240
defaultDatabaseName: 'Animals',
241241
});

packages/@aws-cdk/aws-autoscaling/test/auto-scaling-group.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1791,7 +1791,7 @@ test('can use Vpc imported from unparseable list tokens', () => {
17911791
vpc,
17921792
allowAllOutbound: false,
17931793
associatePublicIpAddress: false,
1794-
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE },
1794+
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT },
17951795
});
17961796

17971797
// THEN

packages/@aws-cdk/aws-batch/test/compute-environment.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ describe('Batch Compute Environment', () => {
347347
],
348348
type: batch.ComputeResourceType.ON_DEMAND,
349349
vpcSubnets: {
350-
subnetType: ec2.SubnetType.PRIVATE,
350+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
351351
},
352352
} as batch.ComputeResources,
353353
enabled: false,

packages/@aws-cdk/aws-cloud9/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ new cloud9.Ec2Environment(this, 'Cloud9Env2', {
5555
const c9env = new cloud9.Ec2Environment(this, 'Cloud9Env3', {
5656
vpc,
5757
subnetSelection: {
58-
subnetType: ec2.SubnetType.PRIVATE,
58+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
5959
},
6060
});
6161

packages/@aws-cdk/aws-cloud9/test/cloud9.environment.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ test('create resource correctly with both vpc and subnetSelectio', () => {
2424
new cloud9.Ec2Environment(stack, 'C9Env', {
2525
vpc,
2626
subnetSelection: {
27-
subnetType: ec2.SubnetType.PRIVATE,
27+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
2828
},
2929
});
3030
// THEN
@@ -54,7 +54,7 @@ test('throw error when subnetSelection not specified and the provided VPC has no
5454
maxAzs: 2,
5555
subnetConfiguration: [
5656
{
57-
subnetType: ec2.SubnetType.ISOLATED,
57+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
5858
name: 'IsolatedSubnet',
5959
cidrMask: 24,
6060
},

packages/@aws-cdk/aws-docdb/test/cluster.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ describe('DatabaseCluster', () => {
108108
vpc,
109109
instanceType: ec2.InstanceType.of(ec2.InstanceClass.R5, ec2.InstanceSize.LARGE),
110110
vpcSubnets: {
111-
subnetType: ec2.SubnetType.PRIVATE,
111+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
112112
},
113113
});
114114
}).toThrowError('Cluster requires at least 2 subnets, got 1');

packages/@aws-cdk/aws-ec2/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ new ec2.InterfaceVpcEndpoint(this, 'VPC Endpoint', {
131131
vpc,
132132
service: new ec2.InterfaceVpcEndpointService('com.amazonaws.vpce.us-east-1.vpce-svc-uuddlrlrbastrtsvc', 443),
133133
subnets: {
134-
subnetType: ec2.SubnetType.ISOLATED,
134+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
135135
availabilityZones: ['us-east-1a', 'us-east-1c']
136136
}
137137
});
@@ -325,7 +325,7 @@ const vpc = new ec2.Vpc(this, "VPC", {
325325
subnetType: ec2.SubnetType.PUBLIC,
326326
name: 'Public',
327327
},{
328-
subnetType: ec2.SubnetType.ISOLATED,
328+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
329329
name: 'Isolated',
330330
}]
331331
});
@@ -372,7 +372,7 @@ const vpc = new ec2.Vpc(this, 'TheVPC', {
372372
{
373373
cidrMask: 27,
374374
name: 'Database',
375-
subnetType: ec2.SubnetType.ISOLATED,
375+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
376376
}
377377
],
378378
});

packages/@aws-cdk/aws-ecs-patterns/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -491,7 +491,7 @@ const queueProcessingFargateService = new ecsPatterns.QueueProcessingFargateServ
491491
memoryLimitMiB: 512,
492492
image: ecs.ContainerImage.fromRegistry('test'),
493493
securityGroups: [securityGroup],
494-
taskSubnets: { subnetType: ec2.SubnetType.ISOLATED },
494+
taskSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
495495
});
496496
```
497497

packages/@aws-cdk/aws-ecs-patterns/lib/base/scheduled-task-base.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ export abstract class ScheduledTaskBase extends CoreConstruct {
161161
throw new Error('You must specify a desiredTaskCount greater than 0');
162162
}
163163
this.desiredTaskCount = props.desiredTaskCount || 1;
164-
this.subnetSelection = props.subnetSelection || { subnetType: SubnetType.PRIVATE };
164+
this.subnetSelection = props.subnetSelection || { subnetType: SubnetType.PRIVATE_WITH_NAT };
165165
this._securityGroups = props.securityGroups;
166166

167167
// An EventRule that describes the event trigger (in this case a scheduled run)

packages/@aws-cdk/aws-ecs-patterns/test/fargate/integ.queue-processing-fargate-service-isolated.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ const vpc = new ec2.Vpc(stack, 'VPC', {
1818
{
1919
cidrMask: 24,
2020
name: 'Isolated',
21-
subnetType: ec2.SubnetType.ISOLATED,
21+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
2222
},
2323
],
2424
});
2525

2626

27-
vpc.addS3Endpoint('S3Endpoint', [{ subnetType: ec2.SubnetType.ISOLATED }]);
27+
vpc.addS3Endpoint('S3Endpoint', [{ subnetType: ec2.SubnetType.PRIVATE_ISOLATED }]);
2828

2929
const securityGroup = new ec2.SecurityGroup(stack, 'MyCustomSG', {
3030
vpc,
@@ -35,7 +35,7 @@ const queueProcessing = new QueueProcessingFargateService(stack, 'IsolatedQueueS
3535
memoryLimitMiB: 512,
3636
image: new ecs.AssetImage(path.join(__dirname, '..', 'sqs-reader')),
3737
securityGroups: [securityGroup],
38-
taskSubnets: { subnetType: ec2.SubnetType.ISOLATED },
38+
taskSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
3939
});
4040

4141
queueProcessing.service.node.addDependency(

packages/@aws-cdk/aws-ecs-patterns/test/fargate/load-balanced-fargate-service.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ test('selecting correct vpcSubnets', () => {
245245
name: 'Public',
246246
},
247247
{
248-
subnetType: ec2.SubnetType.ISOLATED,
248+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
249249
cidrMask: 20,
250250
name: 'ISOLATED',
251251
},
@@ -258,7 +258,7 @@ test('selecting correct vpcSubnets', () => {
258258
image: ecs.ContainerImage.fromRegistry('/aws/aws-example-app'),
259259
},
260260
taskSubnets: {
261-
subnetType: ec2.SubnetType.ISOLATED,
261+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
262262
},
263263
});
264264
// THEN

packages/@aws-cdk/aws-ecs-patterns/test/fargate/queue-processing-fargate-service.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -463,7 +463,7 @@ test('can set custom networking options', () => {
463463
{
464464
cidrMask: 24,
465465
name: 'Isolated',
466-
subnetType: ec2.SubnetType.ISOLATED,
466+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
467467
},
468468
],
469469
});
@@ -477,7 +477,7 @@ test('can set custom networking options', () => {
477477
memoryLimitMiB: 512,
478478
image: ecs.ContainerImage.fromRegistry('test'),
479479
securityGroups: [securityGroup],
480-
taskSubnets: { subnetType: ec2.SubnetType.ISOLATED },
480+
taskSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
481481
});
482482

483483
// THEN - NetworkConfiguration is created with the specific security groups and selected subnets

packages/@aws-cdk/aws-efs/test/efs-file-system.test.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ test('can create when using a VPC with multiple subnets per availability zone',
403403
// create a vpc with two subnets in the same availability zone.
404404
const oneAzVpc = new ec2.Vpc(stack, 'Vpc', {
405405
maxAzs: 1,
406-
subnetConfiguration: [{ name: 'One', subnetType: ec2.SubnetType.ISOLATED }, { name: 'Two', subnetType: ec2.SubnetType.ISOLATED }],
406+
subnetConfiguration: [{ name: 'One', subnetType: ec2.SubnetType.PRIVATE_ISOLATED }, { name: 'Two', subnetType: ec2.SubnetType.PRIVATE_ISOLATED }],
407407
natGateways: 0,
408408
});
409409
new FileSystem(stack, 'EfsFileSystem', {

packages/@aws-cdk/aws-eks-legacy/lib/cluster.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ export interface ClusterProps {
110110
*
111111
* ```ts
112112
* const vpcSubnets = [
113-
* { subnetType: ec2.SubnetType.PRIVATE }
113+
* { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT }
114114
* ]
115115
* ```
116116
*
@@ -368,7 +368,7 @@ export class Cluster extends Resource implements ICluster {
368368
});
369369

370370
// Get subnetIds for all selected subnets
371-
const placements = props.vpcSubnets || [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE }];
371+
const placements = props.vpcSubnets || [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT }];
372372
const subnetIds = [...new Set(Array().concat(...placements.map(s => this.vpc.selectSubnets(s).subnetIds)))];
373373

374374
const clusterProps: CfnClusterProps = {

packages/@aws-cdk/aws-eks/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -579,7 +579,7 @@ declare const vpc: ec2.Vpc;
579579
new eks.Cluster(this, 'HelloEKS', {
580580
version: eks.KubernetesVersion.V1_21,
581581
vpc,
582-
vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE }],
582+
vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_NAT }],
583583
});
584584
```
585585

packages/@aws-cdk/aws-eks/lib/cluster.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ export interface CommonClusterOptions {
405405
*
406406
* For example, to only select private subnets, supply the following:
407407
*
408-
* `vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE }]`
408+
* `vpcSubnets: [{ subnetType: ec2.SubnetType.PRIVATE_WITH_NAT }]`
409409
*
410410
* @default - All public and private subnets
411411
*/
@@ -1342,7 +1342,7 @@ export class Cluster extends ClusterBase {
13421342
description: 'EKS Control Plane Security Group',
13431343
});
13441344

1345-
this.vpcSubnets = props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE }];
1345+
this.vpcSubnets = props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT }];
13461346

13471347
const selectedSubnetIdsPerGroup = this.vpcSubnets.map(s => this.vpc.selectSubnets(s).subnetIds);
13481348
if (selectedSubnetIdsPerGroup.some(Token.isUnresolved) && selectedSubnetIdsPerGroup.length > 1) {

packages/@aws-cdk/aws-eks/lib/fargate-profile.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ export class FargateProfile extends CoreConstruct implements ITaggable {
165165

166166
let subnets: string[] | undefined;
167167
if (props.vpc) {
168-
const selection: ec2.SubnetSelection = props.subnetSelection ?? { subnetType: ec2.SubnetType.PRIVATE };
168+
const selection: ec2.SubnetSelection = props.subnetSelection ?? { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT };
169169
subnets = props.vpc.selectSubnets(selection).subnetIds;
170170
}
171171

packages/@aws-cdk/aws-eks/test/cluster.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ describe('cluster', () => {
135135
test('throws if selecting more than one subnet group', () => {
136136
expect(() => new eks.Cluster(stack, 'Cluster', {
137137
vpc: vpc,
138-
vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE }],
138+
vpcSubnets: [{ subnetType: ec2.SubnetType.PUBLIC }, { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT }],
139139
defaultCapacity: 0,
140140
version: eks.KubernetesVersion.V1_21,
141141
})).toThrow(/cannot select multiple subnet groups/);
@@ -2807,7 +2807,7 @@ describe('cluster', () => {
28072807
natGateways: 1,
28082808
subnetConfiguration: [
28092809
{
2810-
subnetType: ec2.SubnetType.PRIVATE,
2810+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
28112811
name: 'Private1',
28122812
},
28132813
{
@@ -2866,7 +2866,7 @@ describe('cluster', () => {
28662866

28672867
for (let i = 0; i < 20; i++) {
28682868
subnetConfiguration.push({
2869-
subnetType: ec2.SubnetType.PRIVATE,
2869+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
28702870
name: `Private${i}`,
28712871
},
28722872
);
@@ -2915,7 +2915,7 @@ describe('cluster', () => {
29152915

29162916
for (let i = 0; i < 20; i++) {
29172917
subnetConfiguration.push({
2918-
subnetType: ec2.SubnetType.PRIVATE,
2918+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
29192919
name: `Private${i}`,
29202920
},
29212921
);

packages/@aws-cdk/aws-elasticloadbalancing/lib/load-balancer.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ function loadBalancerSubnets(props: LoadBalancerProps): SelectedSubnets {
477477
});
478478
} else {
479479
return props.vpc.selectSubnets({
480-
subnetType: SubnetType.PRIVATE,
480+
subnetType: SubnetType.PRIVATE_WITH_NAT,
481481
});
482482
}
483483
}

packages/@aws-cdk/aws-elasticloadbalancing/test/loadbalancer.test.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ describe('tests', () => {
151151
},
152152
{
153153
name: 'private1',
154-
subnetType: SubnetType.PRIVATE,
154+
subnetType: SubnetType.PRIVATE_WITH_NAT,
155155
cidrMask: 21,
156156
},
157157
{
158158
name: 'private2',
159-
subnetType: SubnetType.PRIVATE,
159+
subnetType: SubnetType.PRIVATE_WITH_NAT,
160160
cidrMask: 21,
161161
},
162162
],

packages/@aws-cdk/aws-elasticloadbalancingv2/test/nlb/load-balancer.test.ts

+8-8
Original file line numberDiff line numberDiff line change
@@ -402,7 +402,7 @@ describe('tests', () => {
402402
subnetConfiguration: [{
403403
cidrMask: 20,
404404
name: 'Isolated',
405-
subnetType: ec2.SubnetType.ISOLATED,
405+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
406406
}],
407407
});
408408

@@ -433,11 +433,11 @@ describe('tests', () => {
433433
}, {
434434
cidrMask: 24,
435435
name: 'Private',
436-
subnetType: ec2.SubnetType.PRIVATE,
436+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
437437
}, {
438438
cidrMask: 28,
439439
name: 'Isolated',
440-
subnetType: ec2.SubnetType.ISOLATED,
440+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
441441
}],
442442
});
443443

@@ -468,11 +468,11 @@ describe('tests', () => {
468468
}, {
469469
cidrMask: 24,
470470
name: 'Private',
471-
subnetType: ec2.SubnetType.PRIVATE,
471+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
472472
}, {
473473
cidrMask: 28,
474474
name: 'Isolated',
475-
subnetType: ec2.SubnetType.ISOLATED,
475+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
476476
}],
477477
});
478478

@@ -525,19 +525,19 @@ describe('tests', () => {
525525
}, {
526526
cidrMask: 24,
527527
name: 'Private',
528-
subnetType: ec2.SubnetType.PRIVATE,
528+
subnetType: ec2.SubnetType.PRIVATE_WITH_NAT,
529529
}, {
530530
cidrMask: 28,
531531
name: 'Isolated',
532-
subnetType: ec2.SubnetType.ISOLATED,
532+
subnetType: ec2.SubnetType.PRIVATE_ISOLATED,
533533
}],
534534
});
535535

536536
// WHEN
537537
new elbv2.NetworkLoadBalancer(stack, 'LB', {
538538
vpc,
539539
internetFacing: false,
540-
vpcSubnets: { subnetType: ec2.SubnetType.ISOLATED },
540+
vpcSubnets: { subnetType: ec2.SubnetType.PRIVATE_ISOLATED },
541541
});
542542

543543
// THEN

packages/@aws-cdk/aws-elasticsearch/lib/domain.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1502,7 +1502,7 @@ export class Domain extends DomainBase implements IDomain, ec2.IConnectable {
15021502
let subnets: ec2.ISubnet[] | undefined;
15031503

15041504
if (props.vpc) {
1505-
subnets = selectSubnets(props.vpc, props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PRIVATE }]);
1505+
subnets = selectSubnets(props.vpc, props.vpcSubnets ?? [{ subnetType: ec2.SubnetType.PRIVATE_WITH_NAT }]);
15061506
securityGroups = props.securityGroups ?? [new ec2.SecurityGroup(this, 'SecurityGroup', {
15071507
vpc: props.vpc,
15081508
description: `Security group for domain ${this.node.id}`,

packages/@aws-cdk/aws-events-targets/lib/ecs-task.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ export class EcsTask implements events.IRuleTarget {
162162
const taskCount = this.taskCount;
163163
const taskDefinitionArn = this.taskDefinition.taskDefinitionArn;
164164

165-
const subnetSelection = this.props.subnetSelection || { subnetType: ec2.SubnetType.PRIVATE };
165+
const subnetSelection = this.props.subnetSelection || { subnetType: ec2.SubnetType.PRIVATE_WITH_NAT };
166166
const assignPublicIp = subnetSelection.subnetType === ec2.SubnetType.PUBLIC ? 'ENABLED' : 'DISABLED';
167167

168168
const baseEcsParameters = { taskCount, taskDefinitionArn };

0 commit comments

Comments
 (0)