diff --git a/packages/@aws-cdk/aws-ec2-alpha/README.md b/packages/@aws-cdk/aws-ec2-alpha/README.md index 07758cfdfb7f2..ef9a034942b56 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/README.md +++ b/packages/@aws-cdk/aws-ec2-alpha/README.md @@ -149,6 +149,24 @@ new vpc_v2.Route(this, 'IgwRoute', { }); ``` +Alternatively, `Route`s can be created via a method in the `RouteTable` class. An example using the `EgressOnlyInternetGateway` construct can be seen below: +Note: `EgressOnlyInternetGateway` can only be used to set up outbound IPv6 routing. + +```ts +import * as vpc_v2 from '@aws-cdk/aws-ec2-alpha'; + +const myVpc = new vpc_v2.VpcV2(stack, 'Vpc', {...}); +const routeTable = new vpc_v2.RouteTable(stack, 'RouteTable', { + vpc: vpc.myVpc, +}); +const subnet = new vpc_v2.SubnetV2(stack, 'Subnet', {...}); + +const eigw = new vpc_v2.EgressOnlyInternetGateway(stack, 'EIGW', { + vpcId: vpc.myVpc, +}); +routeTable.addRoute('::/0', { gateway: eigw }); +``` + Other route targets may require a deeper set of parameters to set up properly. For instance, the example below illustrates how to set up a `NatGateway`: ```ts diff --git a/packages/@aws-cdk/aws-ec2-alpha/lib/route.ts b/packages/@aws-cdk/aws-ec2-alpha/lib/route.ts index 3a6a0ea5cd717..7420375537880 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/lib/route.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/lib/route.ts @@ -2,6 +2,7 @@ import { CfnEIP, CfnEgressOnlyInternetGateway, CfnInternetGateway, CfnNatGateway import { Construct, IDependable } from 'constructs'; import { Duration, Resource } from 'aws-cdk-lib/core'; import { IVpcV2 } from './vpc-v2-base'; +import { NetworkUtils } from './util'; /** * Indicates whether the NAT gateway supports public or private connectivity. @@ -408,7 +409,7 @@ export class RouteTargetType { /** * Interface to define a route. */ -export interface IRouteV2 { +interface IRoute { /** * The ID of the route table for the route. * @attribute routeTable @@ -432,7 +433,7 @@ export interface IRouteV2 { /** * Properties to define a route. */ -export interface RouteProps { +interface RouteProps { /** * The ID of the route table for the route. * @attribute routeTable @@ -462,7 +463,7 @@ export interface RouteProps { * Creates a new route with added functionality. * @resource AWS::EC2::Route */ -export class Route extends Resource implements IRouteV2 { +class Route extends Resource implements IRoute { /** * The IPv4 or IPv6 CIDR block used for the destination match. * @@ -491,13 +492,26 @@ export class Route extends Resource implements IRouteV2 { */ public readonly resource?: CfnRoute; + /** + * Destination cidr block for ipv4 or ipv6 + */ + private destinationIpv6Cidr?: string; + constructor(scope: Construct, id: string, props: RouteProps) { super(scope, id); - this.destination = props.destination; this.target = props.target; this.routeTable = props.routeTable; + this.destination = props.destination; + const isDestinationIpv4 = NetworkUtils.validIp(props.destination); + if (!isDestinationIpv4) { + //TODO Validate for IPv6 CIDR range + this.destinationIpv6Cidr = props.destination; + } + if (this.target.gateway?.routerType == RouterType.EGRESS_ONLY_INTERNET_GATEWAY && isDestinationIpv4) { + throw new Error('Egress only internet gateway does not support IPv4 routing'); + } this.targetRouterType = this.target.gateway ? this.target.gateway.routerType : RouterType.VPC_ENDPOINT; // Gateway generates route automatically via its RouteTable, thus we don't need to generate the resource for it @@ -505,7 +519,7 @@ export class Route extends Resource implements IRouteV2 { this.resource = new CfnRoute(this, 'Route', { routeTableId: this.routeTable.routeTableId, destinationCidrBlock: this.destination, - destinationIpv6CidrBlock: this.destination, + destinationIpv6CidrBlock: this.destinationIpv6Cidr, [routerTypeToPropName(this.targetRouterType)]: this.target.gateway ? this.target.gateway.routerTargetId : this.target.endpoint ? this.target.endpoint.vpcEndpointId : null, }); @@ -569,6 +583,23 @@ export class RouteTable extends Resource implements IRouteTable, IDependable { this.routeTableId = this.resource.attrRouteTableId; } + + /** + * Adds a new custom route to the route table. + * @param destination The IPv4 or IPv6 CIDR block used for the destination match. + * @param target The gateway or endpoint targeted by the route. + */ + public addRoute(id: string, destination: string, target: RouteTargetType) { + if (!target.gateway && !target.endpoint) { + throw new Error('Target is defined without a gateway or endpoint.'); + } + + new Route(this, id, { + routeTable: this, + destination: destination, + target: target, + }); + } } function routerTypeToPropName(routerType: RouterType) { diff --git a/packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts b/packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts index a71277d441cbc..8a2d3b3a6047c 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/lib/subnet-v2.ts @@ -1,8 +1,9 @@ import { Resource, Names, Lazy } from 'aws-cdk-lib'; -import { CfnRouteTable, CfnSubnet, CfnSubnetRouteTableAssociation, INetworkAcl, IRouteTable, ISubnet, NetworkAcl, SubnetNetworkAclAssociation, SubnetType } from 'aws-cdk-lib/aws-ec2'; +import { CfnSubnet, CfnSubnetRouteTableAssociation, INetworkAcl, IRouteTable, ISubnet, NetworkAcl, SubnetNetworkAclAssociation, SubnetType } from 'aws-cdk-lib/aws-ec2'; import { Construct, DependencyGroup, IDependable } from 'constructs'; import { IVpcV2 } from './vpc-v2-base'; import { CidrBlock, CidrBlockIpv6 } from './util'; +import { RouteTable } from './route'; /** * Interface to define subnet CIDR @@ -145,11 +146,6 @@ export class SubnetV2 extends Resource implements ISubnetV2 { */ public readonly ipv6CidrBlock?: string; - /** - * The route table for this subnet - */ - public readonly routeTable: IRouteTable; - /** * The type of subnet (public or private) that this subnet represents. * @attribute SubnetType @@ -158,6 +154,10 @@ export class SubnetV2 extends Resource implements ISubnetV2 { private _networkAcl: INetworkAcl; + private _routeTable: IRouteTable; + + private routeTableAssociation: CfnSubnetRouteTableAssociation; + /** * Constructs a new SubnetV2 instance. * @param scope The parent Construct that this resource will be part of. @@ -214,19 +214,22 @@ export class SubnetV2 extends Resource implements ISubnetV2 { this._networkAcl = NetworkAcl.fromNetworkAclId(this, 'Acl', subnet.attrNetworkAclAssociationId); if (props.routeTable) { - this.routeTable = props.routeTable; + this._routeTable = props.routeTable; } else { - const defaultTable = new CfnRouteTable(this, 'RouteTable', { - vpcId: props.vpc.vpcId, + // Assigning a default route table + this._routeTable = new RouteTable(this, 'RouteTable', { + vpc: props.vpc, }); - this.routeTable = { routeTableId: defaultTable.ref }; } const routeAssoc = new CfnSubnetRouteTableAssociation(this, 'RouteTableAssociation', { subnetId: this.subnetId, - routeTableId: this.routeTable.routeTableId, + routeTableId: this._routeTable.routeTableId, }); + + this.routeTableAssociation = routeAssoc; this._internetConnectivityEstablished.add(routeAssoc); + this.internetConnectivityEstablished = this._internetConnectivityEstablished; this.subnetType = props.subnetType; @@ -250,6 +253,23 @@ export class SubnetV2 extends Resource implements ISubnetV2 { subnet: this, }); } + + /** + * Return the Route Table associated with this subnet + */ + public get routeTable(): IRouteTable { + return this._routeTable; + } + + /** + * Associate a Route Table with this subnet. + * @param routeTableProps The Route Table to associate with this subnet. + */ + public associateRouteTable(routeTableProps: IRouteTable) { + this._routeTable = routeTableProps; + this.routeTableAssociation.addPropertyOverride('RouteTableId', routeTableProps.routeTableId); + } + /** * Returns the Network ACL associated with this subnet. */ diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-alpha.assets.json index f61a2717f93a6..953b3a4ae82e9 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-alpha.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { - "b3d06cef480a17aaf78379d18a13893141f2d689a23bcbbcf34b284e77752b0f": { + "a963276e8401c096a74f0dc50ac7d80bb5f2bff399fce8c571660a0684ff54b7": { "source": { "path": "aws-cdk-routev2-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "b3d06cef480a17aaf78379d18a13893141f2d689a23bcbbcf34b284e77752b0f.json", + "objectKey": "a963276e8401c096a74f0dc50ac7d80bb5f2bff399fce8c571660a0684ff54b7.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-alpha.template.json index 140f9ebf102e0..0aa074e2e7b1f 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-alpha.template.json @@ -36,7 +36,7 @@ "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "us-west-1a", + "AvailabilityZone": "us-east-1a", "CidrBlock": "10.0.0.0/24", "Ipv6CidrBlock": { "Fn::Select": [ diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-dynamodbendpoint-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-dynamodbendpoint-alpha.assets.json index b9734dc366438..6f27e2c04e801 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-dynamodbendpoint-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-dynamodbendpoint-alpha.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { - "7711ae87a96bcf4e738e5904b6071f21ac59ee14247c420b0bf33d20a87348a3": { + "8b4b159425cc7d11fa6fd993c53e299319dd2fcea18d745e873a18d3ee156a50": { "source": { "path": "aws-cdk-routev2-dynamodbendpoint-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7711ae87a96bcf4e738e5904b6071f21ac59ee14247c420b0bf33d20a87348a3.json", + "objectKey": "8b4b159425cc7d11fa6fd993c53e299319dd2fcea18d745e873a18d3ee156a50.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-dynamodbendpoint-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-dynamodbendpoint-alpha.template.json index 1fc8a4ff1bbe3..7aaf0a70fd923 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-dynamodbendpoint-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-dynamodbendpoint-alpha.template.json @@ -36,7 +36,7 @@ "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "us-west-1a", + "AvailabilityZone": "us-east-1a", "CidrBlock": "10.0.0.0/24", "Ipv6CidrBlock": { "Fn::Select": [ diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-egressonlyigw-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-egressonlyigw-alpha.assets.json index b27c0c57931d5..d17484319eef3 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-egressonlyigw-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-egressonlyigw-alpha.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { - "6cd56bb964ed1f90f0206d705f085aef381173834b50d5ba372fa2185156d51d": { + "b0e303439a83ae17adf592a6599e13f880529abf2f46f433af0742284a224385": { "source": { "path": "aws-cdk-routev2-egressonlyigw-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "6cd56bb964ed1f90f0206d705f085aef381173834b50d5ba372fa2185156d51d.json", + "objectKey": "b0e303439a83ae17adf592a6599e13f880529abf2f46f433af0742284a224385.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-egressonlyigw-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-egressonlyigw-alpha.template.json index 1c4d9adad8e08..cd3a0c0a42484 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-egressonlyigw-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-egressonlyigw-alpha.template.json @@ -32,11 +32,30 @@ } } }, + "TestRoottableeigwRouteF867084E": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "::/0", + "DestinationIpv6CidrBlock": "::/0", + "EgressOnlyInternetGatewayId": { + "Fn::GetAtt": [ + "testEOIGWEIGW54CCAD37", + "Id" + ] + }, + "RouteTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, "eigwSubnetCC28B9F9": { "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "us-west-1a", + "AvailabilityZone": "us-east-1a", "CidrBlock": "10.0.0.0/24", "VpcId": { "Fn::GetAtt": [ @@ -76,25 +95,6 @@ ] } } - }, - "testEIGWRouteEB4FE8D5": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "DestinationIpv6CidrBlock": "0.0.0.0/0", - "EgressOnlyInternetGatewayId": { - "Fn::GetAtt": [ - "testEOIGWEIGW54CCAD37", - "Id" - ] - }, - "RouteTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } } }, "Parameters": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-igw-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-igw-alpha.assets.json index 677f15417b1ed..a62abd102c23c 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-igw-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-igw-alpha.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { - "44c69eec973961e184209d04e6e45c230320a2f7a110f0275431dc0587273038": { + "62f0873928dbdff7cc7c914e7275014da0d4f8e188fb633ea74a8cae7129ea0b": { "source": { "path": "aws-cdk-routev2-igw-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "44c69eec973961e184209d04e6e45c230320a2f7a110f0275431dc0587273038.json", + "objectKey": "62f0873928dbdff7cc7c914e7275014da0d4f8e188fb633ea74a8cae7129ea0b.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-igw-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-igw-alpha.template.json index 1ddb6c3cc40d9..1e21b3bc2c96f 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-igw-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-igw-alpha.template.json @@ -32,11 +32,46 @@ } } }, + "TestRoottableigwRouteC52EF731": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Fn::GetAtt": [ + "testIGW8D947AF2", + "InternetGatewayId" + ] + }, + "RouteTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "TestRoottableigwRouteGWAttachment4B3E8FD9": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Fn::GetAtt": [ + "testIGW8D947AF2", + "InternetGatewayId" + ] + }, + "VpcId": { + "Fn::GetAtt": [ + "igw127F1970", + "VpcId" + ] + } + } + }, "igwSubnetF238E402": { "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "us-west-1a", + "AvailabilityZone": "us-east-1a", "CidrBlock": "10.0.0.0/24", "Ipv6CidrBlock": { "Fn::Select": [ @@ -79,42 +114,6 @@ }, "testIGW8D947AF2": { "Type": "AWS::EC2::InternetGateway" - }, - "testIGWRoute7696715B": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "DestinationIpv6CidrBlock": "0.0.0.0/0", - "GatewayId": { - "Fn::GetAtt": [ - "testIGW8D947AF2", - "InternetGatewayId" - ] - }, - "RouteTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } - }, - "testIGWRouteGWAttachmentB0836D42": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "InternetGatewayId": { - "Fn::GetAtt": [ - "testIGW8D947AF2", - "InternetGatewayId" - ] - }, - "VpcId": { - "Fn::GetAtt": [ - "igw127F1970", - "VpcId" - ] - } - } } }, "Parameters": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-networkif-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-networkif-alpha.assets.json index 733952daae63f..805e32a041de3 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-networkif-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-networkif-alpha.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { - "087e3b456bae228983dc7a31eea1570bfeccfd6b4f163b7e10a2af07dc31291f": { + "434c826abb6c12fb9eebf4adb6aae43788ba6e2a204ad7eea6f60321e69d3b38": { "source": { "path": "aws-cdk-routev2-networkif-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "087e3b456bae228983dc7a31eea1570bfeccfd6b4f163b7e10a2af07dc31291f.json", + "objectKey": "434c826abb6c12fb9eebf4adb6aae43788ba6e2a204ad7eea6f60321e69d3b38.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-networkif-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-networkif-alpha.template.json index d796497fc5388..1e157df23a14a 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-networkif-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-networkif-alpha.template.json @@ -36,7 +36,7 @@ "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "us-west-1a", + "AvailabilityZone": "us-east-1a", "CidrBlock": "10.0.0.0/24", "Ipv6CidrBlock": { "Fn::Select": [ diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-privatenatgw-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-privatenatgw-alpha.assets.json index 591ec9e8d3066..6fae013fe0a29 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-privatenatgw-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-privatenatgw-alpha.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { - "89c945d2b4cb2aa79cca0e52ea8fa68849a586495b0a27b7de229ae44b3c5239": { + "a4d43e15d95d55923771937ed74a05c6bd09a65f55f0c99a5ba9ca05069d7cbd": { "source": { "path": "aws-cdk-routev2-privatenatgw-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "89c945d2b4cb2aa79cca0e52ea8fa68849a586495b0a27b7de229ae44b3c5239.json", + "objectKey": "a4d43e15d95d55923771937ed74a05c6bd09a65f55f0c99a5ba9ca05069d7cbd.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-privatenatgw-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-privatenatgw-alpha.template.json index f2ed7e0d44c03..654e1e1de840e 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-privatenatgw-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-privatenatgw-alpha.template.json @@ -32,11 +32,29 @@ } } }, + "TestRoottablenatGwPrivRoute9F8908DE": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Fn::GetAtt": [ + "testNATgwNATGateway1533420D", + "NatGatewayId" + ] + }, + "RouteTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, "natgwprivSubnetE547C5A0": { "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "us-west-1a", + "AvailabilityZone": "us-east-1a", "CidrBlock": "10.0.0.0/24", "Ipv6CidrBlock": { "Fn::Select": [ @@ -94,25 +112,6 @@ "DependsOn": [ "natgwprivSubnetRouteTableAssociation9E115869" ] - }, - "testNATGWRoute7A26EC80": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "DestinationIpv6CidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Fn::GetAtt": [ - "testNATgwNATGateway1533420D", - "NatGatewayId" - ] - }, - "RouteTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } } }, "Parameters": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-publicnatgw-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-publicnatgw-alpha.assets.json index 29398ffe76faa..f59abe7b20923 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-publicnatgw-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-publicnatgw-alpha.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { - "6592172436ea6af85dd73663ffd81cc1342c29574aa00f4dacf5179cf3054441": { + "85cd968be34ab2030a45e0e808082aa88035954029c2b379b38368ed20327047": { "source": { "path": "aws-cdk-routev2-publicnatgw-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "6592172436ea6af85dd73663ffd81cc1342c29574aa00f4dacf5179cf3054441.json", + "objectKey": "85cd968be34ab2030a45e0e808082aa88035954029c2b379b38368ed20327047.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-publicnatgw-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-publicnatgw-alpha.template.json index 5f80cf56a0aa5..81030e32ede4d 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-publicnatgw-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-publicnatgw-alpha.template.json @@ -32,11 +32,64 @@ } } }, + "TestRoottablenatGwRoute31868FBF": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Fn::GetAtt": [ + "testNATgwIGW6AC97E9A", + "InternetGatewayId" + ] + }, + "RouteTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "TestRoottablenatGwRouteGWAttachment1D9CDF77": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Fn::GetAtt": [ + "testNATgwIGW6AC97E9A", + "InternetGatewayId" + ] + }, + "VpcId": { + "Fn::GetAtt": [ + "natgwpub2FB85986", + "VpcId" + ] + } + } + }, + "TestRoottablenatGwPubRoute0463E2F5": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Fn::GetAtt": [ + "testNATgwNATGateway1533420D", + "NatGatewayId" + ] + }, + "RouteTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, "natgwpubSubnet79D316E5": { "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "us-west-1a", + "AvailabilityZone": "us-east-1a", "CidrBlock": "10.0.0.0/24", "Ipv6CidrBlock": { "Fn::Select": [ @@ -80,42 +133,6 @@ "testNATgwIGW6AC97E9A": { "Type": "AWS::EC2::InternetGateway" }, - "testnatgwigwRouteE8D2BF39": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "242.0.0.0/32", - "DestinationIpv6CidrBlock": "242.0.0.0/32", - "GatewayId": { - "Fn::GetAtt": [ - "testNATgwIGW6AC97E9A", - "InternetGatewayId" - ] - }, - "RouteTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } - }, - "testnatgwigwRouteGWAttachmentB8E1033C": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "InternetGatewayId": { - "Fn::GetAtt": [ - "testNATgwIGW6AC97E9A", - "InternetGatewayId" - ] - }, - "VpcId": { - "Fn::GetAtt": [ - "natgwpub2FB85986", - "VpcId" - ] - } - } - }, "testNATgwEIP1C260FAD": { "Type": "AWS::EC2::EIP", "Properties": { @@ -146,25 +163,6 @@ "DependsOn": [ "natgwpubSubnetRouteTableAssociation019CE26A" ] - }, - "testNATGWRoute7A26EC80": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "DestinationIpv6CidrBlock": "0.0.0.0/0", - "NatGatewayId": { - "Fn::GetAtt": [ - "testNATgwNATGateway1533420D", - "NatGatewayId" - ] - }, - "RouteTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } } }, "Parameters": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-virtualprivategw-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-virtualprivategw-alpha.assets.json index 601d17d534bb8..0cd2e52e78a44 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-virtualprivategw-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-virtualprivategw-alpha.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { - "2318541485e9424ef1bba0f0bb0e0e91e2759dc53597436fb250a8605e5e0107": { + "fa2b156112be3f11361259d8aaafcd552d28499bba4cc881642fdc98bc04c924": { "source": { "path": "aws-cdk-routev2-virtualprivategw-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "2318541485e9424ef1bba0f0bb0e0e91e2759dc53597436fb250a8605e5e0107.json", + "objectKey": "fa2b156112be3f11361259d8aaafcd552d28499bba4cc881642fdc98bc04c924.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-virtualprivategw-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-virtualprivategw-alpha.template.json index f96743310fabe..b25f6ff502905 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-virtualprivategw-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-virtualprivategw-alpha.template.json @@ -32,11 +32,46 @@ } } }, + "TestRoottablevpgwRouteAD510A2A": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Fn::GetAtt": [ + "testVPGWIGW816C7C4F", + "VPNGatewayId" + ] + }, + "RouteTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "TestRoottablevpgwRouteGWAttachmentDD0077EE": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "VpcId": { + "Fn::GetAtt": [ + "vpgw2AB64B6B", + "VpcId" + ] + }, + "VpnGatewayId": { + "Fn::GetAtt": [ + "testVPGWIGW816C7C4F", + "VPNGatewayId" + ] + } + } + }, "vpgwSubnet5E7F36AD": { "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "us-west-1a", + "AvailabilityZone": "us-east-1a", "CidrBlock": "10.0.0.0/24", "Ipv6CidrBlock": { "Fn::Select": [ @@ -82,42 +117,6 @@ "Properties": { "Type": "ipsec.1" } - }, - "testVPGWRouteA169B1AA": { - "Type": "AWS::EC2::Route", - "Properties": { - "DestinationCidrBlock": "0.0.0.0/0", - "DestinationIpv6CidrBlock": "0.0.0.0/0", - "GatewayId": { - "Fn::GetAtt": [ - "testVPGWIGW816C7C4F", - "VPNGatewayId" - ] - }, - "RouteTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } - }, - "testVPGWRouteGWAttachment01E74575": { - "Type": "AWS::EC2::VPCGatewayAttachment", - "Properties": { - "VpcId": { - "Fn::GetAtt": [ - "vpgw2AB64B6B", - "VpcId" - ] - }, - "VpnGatewayId": { - "Fn::GetAtt": [ - "testVPGWIGW816C7C4F", - "VPNGatewayId" - ] - } - } } }, "Parameters": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-vpcpeerconnection-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-vpcpeerconnection-alpha.assets.json index fa96e660e9d19..94cc48acf6542 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-vpcpeerconnection-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-vpcpeerconnection-alpha.assets.json @@ -1,7 +1,7 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { - "7b04eb9c84a61a91a957fceb96a85b38336f8b5999d1c0b5b972cd191926c473": { + "fa56ca630709a15070b4208becd94454c974906d445fd83b73389524957f89e8": { "source": { "path": "aws-cdk-routev2-vpcpeerconnection-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "7b04eb9c84a61a91a957fceb96a85b38336f8b5999d1c0b5b972cd191926c473.json", + "objectKey": "fa56ca630709a15070b4208becd94454c974906d445fd83b73389524957f89e8.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-vpcpeerconnection-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-vpcpeerconnection-alpha.template.json index 804f7b179ac91..7f195e58f758f 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-vpcpeerconnection-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/aws-cdk-routev2-vpcpeerconnection-alpha.template.json @@ -36,7 +36,7 @@ "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "us-west-1a", + "AvailabilityZone": "us-east-1a", "CidrBlock": "10.0.0.0/24", "Ipv6CidrBlock": { "Fn::Select": [ diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/cdk.out b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/cdk.out index 1f0068d32659a..bd5311dc372de 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/cdk.out +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/cdk.out @@ -1 +1 @@ -{"version":"36.0.0"} \ No newline at end of file +{"version":"36.0.5"} \ No newline at end of file diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integ.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integ.json index 4ba304a14b0f1..488691ab97ceb 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integ.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integ.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "testCases": { "integtest-model-8/DefaultTest": { "stacks": [ diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel0DefaultTestDeployAssertA16689B0.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel0DefaultTestDeployAssertA16689B0.assets.json index db0c4fcd06799..6f5363d26cf89 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel0DefaultTestDeployAssertA16689B0.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel0DefaultTestDeployAssertA16689B0.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel1DefaultTestDeployAssert46FEDE40.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel1DefaultTestDeployAssert46FEDE40.assets.json index 494dbc93fd34d..9094ce35beea5 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel1DefaultTestDeployAssert46FEDE40.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel1DefaultTestDeployAssert46FEDE40.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel2DefaultTestDeployAssert04E3783E.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel2DefaultTestDeployAssert04E3783E.assets.json index 063e77bfac0d8..29387894579ea 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel2DefaultTestDeployAssert04E3783E.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel2DefaultTestDeployAssert04E3783E.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel3DefaultTestDeployAssertF3FA2F74.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel3DefaultTestDeployAssertF3FA2F74.assets.json index 3b7039646f51f..6afa1f9195a7b 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel3DefaultTestDeployAssertF3FA2F74.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel3DefaultTestDeployAssertF3FA2F74.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel4DefaultTestDeployAssert4B12233C.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel4DefaultTestDeployAssert4B12233C.assets.json index a760a50f08dc1..2170d2cd526f2 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel4DefaultTestDeployAssert4B12233C.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel4DefaultTestDeployAssert4B12233C.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel5DefaultTestDeployAssertC0DDB875.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel5DefaultTestDeployAssertC0DDB875.assets.json index 34f6c443f8be6..aed458dfb9b1f 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel5DefaultTestDeployAssertC0DDB875.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel5DefaultTestDeployAssertC0DDB875.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel6DefaultTestDeployAssert90B004F4.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel6DefaultTestDeployAssert90B004F4.assets.json index 933d02b8072da..29423943325fc 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel6DefaultTestDeployAssert90B004F4.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel6DefaultTestDeployAssert90B004F4.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel7DefaultTestDeployAssert4C509DCE.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel7DefaultTestDeployAssert4C509DCE.assets.json index 57cecd7995331..6fe2b5a955f17 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel7DefaultTestDeployAssert4C509DCE.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel7DefaultTestDeployAssert4C509DCE.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel8DefaultTestDeployAssert77221752.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel8DefaultTestDeployAssert77221752.assets.json index c9d2f2fc69193..d9fd3cff95553 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel8DefaultTestDeployAssert77221752.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/integtestmodel8DefaultTestDeployAssert77221752.assets.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "files": { "21fbb51d7b23f6a6c262b46a9caee79d744a3ac019fd45422d988b96d44b2a22": { "source": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/manifest.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/manifest.json index 2dec0815f28b0..2e922475b66bf 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/manifest.json @@ -1,5 +1,5 @@ { - "version": "36.0.0", + "version": "36.0.5", "artifacts": { "aws-cdk-routev2-alpha.assets": { "type": "cdk:asset-manifest", @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/b3d06cef480a17aaf78379d18a13893141f2d689a23bcbbcf34b284e77752b0f.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a963276e8401c096a74f0dc50ac7d80bb5f2bff399fce8c571660a0684ff54b7.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -97,7 +97,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/6cd56bb964ed1f90f0206d705f085aef381173834b50d5ba372fa2185156d51d.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/b0e303439a83ae17adf592a6599e13f880529abf2f46f433af0742284a224385.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -132,6 +132,12 @@ "data": "TestRoottableRouteTableFA28AA38" } ], + "/aws-cdk-routev2-egressonlyigw-alpha/TestRoottable/eigwRoute/Route": [ + { + "type": "aws:cdk:logicalId", + "data": "TestRoottableeigwRouteF867084E" + } + ], "/aws-cdk-routev2-egressonlyigw-alpha/eigwSubnet/Subnet": [ { "type": "aws:cdk:logicalId", @@ -150,12 +156,6 @@ "data": "testEOIGWEIGW54CCAD37" } ], - "/aws-cdk-routev2-egressonlyigw-alpha/testEIGWRoute/Route": [ - { - "type": "aws:cdk:logicalId", - "data": "testEIGWRouteEB4FE8D5" - } - ], "/aws-cdk-routev2-egressonlyigw-alpha/BootstrapVersion": [ { "type": "aws:cdk:logicalId", @@ -188,7 +188,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/44c69eec973961e184209d04e6e45c230320a2f7a110f0275431dc0587273038.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/62f0873928dbdff7cc7c914e7275014da0d4f8e188fb633ea74a8cae7129ea0b.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -223,34 +223,34 @@ "data": "TestRoottableRouteTableFA28AA38" } ], - "/aws-cdk-routev2-igw-alpha/igwSubnet/Subnet": [ + "/aws-cdk-routev2-igw-alpha/TestRoottable/igwRoute/Route": [ { "type": "aws:cdk:logicalId", - "data": "igwSubnetF238E402" + "data": "TestRoottableigwRouteC52EF731" } ], - "/aws-cdk-routev2-igw-alpha/igwSubnet/RouteTableAssociation": [ + "/aws-cdk-routev2-igw-alpha/TestRoottable/igwRoute/GWAttachment": [ { "type": "aws:cdk:logicalId", - "data": "igwSubnetRouteTableAssociationA48C27F3" + "data": "TestRoottableigwRouteGWAttachment4B3E8FD9" } ], - "/aws-cdk-routev2-igw-alpha/testIGW/IGW": [ + "/aws-cdk-routev2-igw-alpha/igwSubnet/Subnet": [ { "type": "aws:cdk:logicalId", - "data": "testIGW8D947AF2" + "data": "igwSubnetF238E402" } ], - "/aws-cdk-routev2-igw-alpha/testIGWRoute/Route": [ + "/aws-cdk-routev2-igw-alpha/igwSubnet/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", - "data": "testIGWRoute7696715B" + "data": "igwSubnetRouteTableAssociationA48C27F3" } ], - "/aws-cdk-routev2-igw-alpha/testIGWRoute/GWAttachment": [ + "/aws-cdk-routev2-igw-alpha/testIGW/IGW": [ { "type": "aws:cdk:logicalId", - "data": "testIGWRouteGWAttachmentB0836D42" + "data": "testIGW8D947AF2" } ], "/aws-cdk-routev2-igw-alpha/BootstrapVersion": [ @@ -285,7 +285,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/2318541485e9424ef1bba0f0bb0e0e91e2759dc53597436fb250a8605e5e0107.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fa2b156112be3f11361259d8aaafcd552d28499bba4cc881642fdc98bc04c924.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -320,34 +320,34 @@ "data": "TestRoottableRouteTableFA28AA38" } ], - "/aws-cdk-routev2-virtualprivategw-alpha/vpgwSubnet/Subnet": [ + "/aws-cdk-routev2-virtualprivategw-alpha/TestRoottable/vpgwRoute/Route": [ { "type": "aws:cdk:logicalId", - "data": "vpgwSubnet5E7F36AD" + "data": "TestRoottablevpgwRouteAD510A2A" } ], - "/aws-cdk-routev2-virtualprivategw-alpha/vpgwSubnet/RouteTableAssociation": [ + "/aws-cdk-routev2-virtualprivategw-alpha/TestRoottable/vpgwRoute/GWAttachment": [ { "type": "aws:cdk:logicalId", - "data": "vpgwSubnetRouteTableAssociation49921F90" + "data": "TestRoottablevpgwRouteGWAttachmentDD0077EE" } ], - "/aws-cdk-routev2-virtualprivategw-alpha/testVPGW/IGW": [ + "/aws-cdk-routev2-virtualprivategw-alpha/vpgwSubnet/Subnet": [ { "type": "aws:cdk:logicalId", - "data": "testVPGWIGW816C7C4F" + "data": "vpgwSubnet5E7F36AD" } ], - "/aws-cdk-routev2-virtualprivategw-alpha/testVPGWRoute/Route": [ + "/aws-cdk-routev2-virtualprivategw-alpha/vpgwSubnet/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", - "data": "testVPGWRouteA169B1AA" + "data": "vpgwSubnetRouteTableAssociation49921F90" } ], - "/aws-cdk-routev2-virtualprivategw-alpha/testVPGWRoute/GWAttachment": [ + "/aws-cdk-routev2-virtualprivategw-alpha/testVPGW/IGW": [ { "type": "aws:cdk:logicalId", - "data": "testVPGWRouteGWAttachment01E74575" + "data": "testVPGWIGW816C7C4F" } ], "/aws-cdk-routev2-virtualprivategw-alpha/BootstrapVersion": [ @@ -382,7 +382,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/6592172436ea6af85dd73663ffd81cc1342c29574aa00f4dacf5179cf3054441.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/85cd968be34ab2030a45e0e808082aa88035954029c2b379b38368ed20327047.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -417,52 +417,52 @@ "data": "TestRoottableRouteTableFA28AA38" } ], - "/aws-cdk-routev2-publicnatgw-alpha/natgw_pubSubnet/Subnet": [ + "/aws-cdk-routev2-publicnatgw-alpha/TestRoottable/natGwRoute/Route": [ { "type": "aws:cdk:logicalId", - "data": "natgwpubSubnet79D316E5" + "data": "TestRoottablenatGwRoute31868FBF" } ], - "/aws-cdk-routev2-publicnatgw-alpha/natgw_pubSubnet/RouteTableAssociation": [ + "/aws-cdk-routev2-publicnatgw-alpha/TestRoottable/natGwRoute/GWAttachment": [ { "type": "aws:cdk:logicalId", - "data": "natgwpubSubnetRouteTableAssociation019CE26A" + "data": "TestRoottablenatGwRouteGWAttachment1D9CDF77" } ], - "/aws-cdk-routev2-publicnatgw-alpha/testNATgwIGW/IGW": [ + "/aws-cdk-routev2-publicnatgw-alpha/TestRoottable/natGwPubRoute/Route": [ { "type": "aws:cdk:logicalId", - "data": "testNATgwIGW6AC97E9A" + "data": "TestRoottablenatGwPubRoute0463E2F5" } ], - "/aws-cdk-routev2-publicnatgw-alpha/testnatgwigwRoute/Route": [ + "/aws-cdk-routev2-publicnatgw-alpha/natgw_pubSubnet/Subnet": [ { "type": "aws:cdk:logicalId", - "data": "testnatgwigwRouteE8D2BF39" + "data": "natgwpubSubnet79D316E5" } ], - "/aws-cdk-routev2-publicnatgw-alpha/testnatgwigwRoute/GWAttachment": [ + "/aws-cdk-routev2-publicnatgw-alpha/natgw_pubSubnet/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", - "data": "testnatgwigwRouteGWAttachmentB8E1033C" + "data": "natgwpubSubnetRouteTableAssociation019CE26A" } ], - "/aws-cdk-routev2-publicnatgw-alpha/testNATgw/EIP": [ + "/aws-cdk-routev2-publicnatgw-alpha/testNATgwIGW/IGW": [ { "type": "aws:cdk:logicalId", - "data": "testNATgwEIP1C260FAD" + "data": "testNATgwIGW6AC97E9A" } ], - "/aws-cdk-routev2-publicnatgw-alpha/testNATgw/NATGateway": [ + "/aws-cdk-routev2-publicnatgw-alpha/testNATgw/EIP": [ { "type": "aws:cdk:logicalId", - "data": "testNATgwNATGateway1533420D" + "data": "testNATgwEIP1C260FAD" } ], - "/aws-cdk-routev2-publicnatgw-alpha/testNATGWRoute/Route": [ + "/aws-cdk-routev2-publicnatgw-alpha/testNATgw/NATGateway": [ { "type": "aws:cdk:logicalId", - "data": "testNATGWRoute7A26EC80" + "data": "testNATgwNATGateway1533420D" } ], "/aws-cdk-routev2-publicnatgw-alpha/BootstrapVersion": [ @@ -497,7 +497,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/89c945d2b4cb2aa79cca0e52ea8fa68849a586495b0a27b7de229ae44b3c5239.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a4d43e15d95d55923771937ed74a05c6bd09a65f55f0c99a5ba9ca05069d7cbd.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -532,6 +532,12 @@ "data": "TestRoottableRouteTableFA28AA38" } ], + "/aws-cdk-routev2-privatenatgw-alpha/TestRoottable/natGwPrivRoute/Route": [ + { + "type": "aws:cdk:logicalId", + "data": "TestRoottablenatGwPrivRoute9F8908DE" + } + ], "/aws-cdk-routev2-privatenatgw-alpha/natgw_privSubnet/Subnet": [ { "type": "aws:cdk:logicalId", @@ -550,12 +556,6 @@ "data": "testNATgwNATGateway1533420D" } ], - "/aws-cdk-routev2-privatenatgw-alpha/testNATGWRoute/Route": [ - { - "type": "aws:cdk:logicalId", - "data": "testNATGWRoute7A26EC80" - } - ], "/aws-cdk-routev2-privatenatgw-alpha/BootstrapVersion": [ { "type": "aws:cdk:logicalId", @@ -588,7 +588,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/087e3b456bae228983dc7a31eea1570bfeccfd6b4f163b7e10a2af07dc31291f.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/434c826abb6c12fb9eebf4adb6aae43788ba6e2a204ad7eea6f60321e69d3b38.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -667,7 +667,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7b04eb9c84a61a91a957fceb96a85b38336f8b5999d1c0b5b972cd191926c473.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/fa56ca630709a15070b4208becd94454c974906d445fd83b73389524957f89e8.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -746,7 +746,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/7711ae87a96bcf4e738e5904b6071f21ac59ee14247c420b0bf33d20a87348a3.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/8b4b159425cc7d11fa6fd993c53e299319dd2fcea18d745e873a18d3ee156a50.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -810,15 +810,6 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } - ], - "dynamodbSecondaryIp4EEF58BFBEFB": [ - { - "type": "aws:cdk:logicalId", - "data": "dynamodbSecondaryIp4EEF58BFBEFB", - "trace": [ - "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" - ] - } ] }, "displayName": "aws-cdk-routev2-dynamodbendpoint-alpha" diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/tree.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/tree.json index 7adf7f1621505..68cca1ffdc6ab 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.js.snapshot/tree.json @@ -51,7 +51,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VpcV2", + "fqn": "@aws-cdk/aws-ec2-alpha.VpcV2", "version": "0.0.0" } }, @@ -80,7 +80,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.RouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -95,7 +95,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "us-west-1a", + "availabilityZone": "us-east-1a", "cidrBlock": "10.0.0.0/24", "ipv6CidrBlock": { "Fn::Select": [ @@ -153,7 +153,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.SubnetV2", + "fqn": "@aws-cdk/aws-ec2-alpha.SubnetV2", "version": "0.0.0" } }, @@ -226,7 +226,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VpcV2", + "fqn": "@aws-cdk/aws-ec2-alpha.VpcV2", "version": "0.0.0" } }, @@ -252,10 +252,47 @@ "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", "version": "0.0.0" } + }, + "eigwRoute": { + "id": "eigwRoute", + "path": "aws-cdk-routev2-egressonlyigw-alpha/TestRoottable/eigwRoute", + "children": { + "Route": { + "id": "Route", + "path": "aws-cdk-routev2-egressonlyigw-alpha/TestRoottable/eigwRoute/Route", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "::/0", + "destinationIpv6CidrBlock": "::/0", + "egressOnlyInternetGatewayId": { + "Fn::GetAtt": [ + "testEOIGWEIGW54CCAD37", + "Id" + ] + }, + "routeTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.RouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -270,7 +307,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "us-west-1a", + "availabilityZone": "us-east-1a", "cidrBlock": "10.0.0.0/24", "vpcId": { "Fn::GetAtt": [ @@ -317,7 +354,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.SubnetV2", + "fqn": "@aws-cdk/aws-ec2-alpha.SubnetV2", "version": "0.0.0" } }, @@ -346,44 +383,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.EgressOnlyInternetGateway", - "version": "0.0.0" - } - }, - "testEIGWRoute": { - "id": "testEIGWRoute", - "path": "aws-cdk-routev2-egressonlyigw-alpha/testEIGWRoute", - "children": { - "Route": { - "id": "Route", - "path": "aws-cdk-routev2-egressonlyigw-alpha/testEIGWRoute/Route", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "destinationIpv6CidrBlock": "0.0.0.0/0", - "egressOnlyInternetGatewayId": { - "Fn::GetAtt": [ - "testEOIGWEIGW54CCAD37", - "Id" - ] - }, - "routeTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.Route", + "fqn": "@aws-cdk/aws-ec2-alpha.EgressOnlyInternetGateway", "version": "0.0.0" } }, @@ -456,7 +456,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VpcV2", + "fqn": "@aws-cdk/aws-ec2-alpha.VpcV2", "version": "0.0.0" } }, @@ -482,10 +482,71 @@ "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", "version": "0.0.0" } + }, + "igwRoute": { + "id": "igwRoute", + "path": "aws-cdk-routev2-igw-alpha/TestRoottable/igwRoute", + "children": { + "Route": { + "id": "Route", + "path": "aws-cdk-routev2-igw-alpha/TestRoottable/igwRoute/Route", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Fn::GetAtt": [ + "testIGW8D947AF2", + "InternetGatewayId" + ] + }, + "routeTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "GWAttachment": { + "id": "GWAttachment", + "path": "aws-cdk-routev2-igw-alpha/TestRoottable/igwRoute/GWAttachment", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Fn::GetAtt": [ + "testIGW8D947AF2", + "InternetGatewayId" + ] + }, + "vpcId": { + "Fn::GetAtt": [ + "igw127F1970", + "VpcId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.RouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -500,7 +561,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "us-west-1a", + "availabilityZone": "us-east-1a", "cidrBlock": "10.0.0.0/24", "ipv6CidrBlock": { "Fn::Select": [ @@ -558,7 +619,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.SubnetV2", + "fqn": "@aws-cdk/aws-ec2-alpha.SubnetV2", "version": "0.0.0" } }, @@ -580,69 +641,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.InternetGateway", - "version": "0.0.0" - } - }, - "testIGWRoute": { - "id": "testIGWRoute", - "path": "aws-cdk-routev2-igw-alpha/testIGWRoute", - "children": { - "Route": { - "id": "Route", - "path": "aws-cdk-routev2-igw-alpha/testIGWRoute/Route", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "destinationIpv6CidrBlock": "0.0.0.0/0", - "gatewayId": { - "Fn::GetAtt": [ - "testIGW8D947AF2", - "InternetGatewayId" - ] - }, - "routeTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" - } - }, - "GWAttachment": { - "id": "GWAttachment", - "path": "aws-cdk-routev2-igw-alpha/testIGWRoute/GWAttachment", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "internetGatewayId": { - "Fn::GetAtt": [ - "testIGW8D947AF2", - "InternetGatewayId" - ] - }, - "vpcId": { - "Fn::GetAtt": [ - "igw127F1970", - "VpcId" - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.Route", + "fqn": "@aws-cdk/aws-ec2-alpha.InternetGateway", "version": "0.0.0" } }, @@ -715,7 +714,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VpcV2", + "fqn": "@aws-cdk/aws-ec2-alpha.VpcV2", "version": "0.0.0" } }, @@ -741,10 +740,71 @@ "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", "version": "0.0.0" } + }, + "vpgwRoute": { + "id": "vpgwRoute", + "path": "aws-cdk-routev2-virtualprivategw-alpha/TestRoottable/vpgwRoute", + "children": { + "Route": { + "id": "Route", + "path": "aws-cdk-routev2-virtualprivategw-alpha/TestRoottable/vpgwRoute/Route", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Fn::GetAtt": [ + "testVPGWIGW816C7C4F", + "VPNGatewayId" + ] + }, + "routeTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "GWAttachment": { + "id": "GWAttachment", + "path": "aws-cdk-routev2-virtualprivategw-alpha/TestRoottable/vpgwRoute/GWAttachment", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Fn::GetAtt": [ + "vpgw2AB64B6B", + "VpcId" + ] + }, + "vpnGatewayId": { + "Fn::GetAtt": [ + "testVPGWIGW816C7C4F", + "VPNGatewayId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.RouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -759,7 +819,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "us-west-1a", + "availabilityZone": "us-east-1a", "cidrBlock": "10.0.0.0/24", "ipv6CidrBlock": { "Fn::Select": [ @@ -817,7 +877,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.SubnetV2", + "fqn": "@aws-cdk/aws-ec2-alpha.SubnetV2", "version": "0.0.0" } }, @@ -841,69 +901,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VPNGateway", - "version": "0.0.0" - } - }, - "testVPGWRoute": { - "id": "testVPGWRoute", - "path": "aws-cdk-routev2-virtualprivategw-alpha/testVPGWRoute", - "children": { - "Route": { - "id": "Route", - "path": "aws-cdk-routev2-virtualprivategw-alpha/testVPGWRoute/Route", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "destinationIpv6CidrBlock": "0.0.0.0/0", - "gatewayId": { - "Fn::GetAtt": [ - "testVPGWIGW816C7C4F", - "VPNGatewayId" - ] - }, - "routeTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" - } - }, - "GWAttachment": { - "id": "GWAttachment", - "path": "aws-cdk-routev2-virtualprivategw-alpha/testVPGWRoute/GWAttachment", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Fn::GetAtt": [ - "vpgw2AB64B6B", - "VpcId" - ] - }, - "vpnGatewayId": { - "Fn::GetAtt": [ - "testVPGWIGW816C7C4F", - "VPNGatewayId" - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.Route", + "fqn": "@aws-cdk/aws-ec2-alpha.VPNGateway", "version": "0.0.0" } }, @@ -976,7 +974,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VpcV2", + "fqn": "@aws-cdk/aws-ec2-alpha.VpcV2", "version": "0.0.0" } }, @@ -1002,10 +1000,107 @@ "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", "version": "0.0.0" } + }, + "natGwRoute": { + "id": "natGwRoute", + "path": "aws-cdk-routev2-publicnatgw-alpha/TestRoottable/natGwRoute", + "children": { + "Route": { + "id": "Route", + "path": "aws-cdk-routev2-publicnatgw-alpha/TestRoottable/natGwRoute/Route", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Fn::GetAtt": [ + "testNATgwIGW6AC97E9A", + "InternetGatewayId" + ] + }, + "routeTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "GWAttachment": { + "id": "GWAttachment", + "path": "aws-cdk-routev2-publicnatgw-alpha/TestRoottable/natGwRoute/GWAttachment", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Fn::GetAtt": [ + "testNATgwIGW6AC97E9A", + "InternetGatewayId" + ] + }, + "vpcId": { + "Fn::GetAtt": [ + "natgwpub2FB85986", + "VpcId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + }, + "natGwPubRoute": { + "id": "natGwPubRoute", + "path": "aws-cdk-routev2-publicnatgw-alpha/TestRoottable/natGwPubRoute", + "children": { + "Route": { + "id": "Route", + "path": "aws-cdk-routev2-publicnatgw-alpha/TestRoottable/natGwPubRoute/Route", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Fn::GetAtt": [ + "testNATgwNATGateway1533420D", + "NatGatewayId" + ] + }, + "routeTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.RouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -1020,7 +1115,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "us-west-1a", + "availabilityZone": "us-east-1a", "cidrBlock": "10.0.0.0/24", "ipv6CidrBlock": { "Fn::Select": [ @@ -1078,7 +1173,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.SubnetV2", + "fqn": "@aws-cdk/aws-ec2-alpha.SubnetV2", "version": "0.0.0" } }, @@ -1100,69 +1195,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.InternetGateway", - "version": "0.0.0" - } - }, - "testnatgwigwRoute": { - "id": "testnatgwigwRoute", - "path": "aws-cdk-routev2-publicnatgw-alpha/testnatgwigwRoute", - "children": { - "Route": { - "id": "Route", - "path": "aws-cdk-routev2-publicnatgw-alpha/testnatgwigwRoute/Route", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "242.0.0.0/32", - "destinationIpv6CidrBlock": "242.0.0.0/32", - "gatewayId": { - "Fn::GetAtt": [ - "testNATgwIGW6AC97E9A", - "InternetGatewayId" - ] - }, - "routeTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" - } - }, - "GWAttachment": { - "id": "GWAttachment", - "path": "aws-cdk-routev2-publicnatgw-alpha/testnatgwigwRoute/GWAttachment", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", - "aws:cdk:cloudformation:props": { - "internetGatewayId": { - "Fn::GetAtt": [ - "testNATgwIGW6AC97E9A", - "InternetGatewayId" - ] - }, - "vpcId": { - "Fn::GetAtt": [ - "natgwpub2FB85986", - "VpcId" - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.Route", + "fqn": "@aws-cdk/aws-ec2-alpha.InternetGateway", "version": "0.0.0" } }, @@ -1213,44 +1246,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.NatGateway", - "version": "0.0.0" - } - }, - "testNATGWRoute": { - "id": "testNATGWRoute", - "path": "aws-cdk-routev2-publicnatgw-alpha/testNATGWRoute", - "children": { - "Route": { - "id": "Route", - "path": "aws-cdk-routev2-publicnatgw-alpha/testNATGWRoute/Route", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "destinationIpv6CidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Fn::GetAtt": [ - "testNATgwNATGateway1533420D", - "NatGatewayId" - ] - }, - "routeTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.Route", + "fqn": "@aws-cdk/aws-ec2-alpha.NatGateway", "version": "0.0.0" } }, @@ -1323,7 +1319,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VpcV2", + "fqn": "@aws-cdk/aws-ec2-alpha.VpcV2", "version": "0.0.0" } }, @@ -1349,10 +1345,46 @@ "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", "version": "0.0.0" } + }, + "natGwPrivRoute": { + "id": "natGwPrivRoute", + "path": "aws-cdk-routev2-privatenatgw-alpha/TestRoottable/natGwPrivRoute", + "children": { + "Route": { + "id": "Route", + "path": "aws-cdk-routev2-privatenatgw-alpha/TestRoottable/natGwPrivRoute/Route", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "natGatewayId": { + "Fn::GetAtt": [ + "testNATgwNATGateway1533420D", + "NatGatewayId" + ] + }, + "routeTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.RouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -1367,7 +1399,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "us-west-1a", + "availabilityZone": "us-east-1a", "cidrBlock": "10.0.0.0/24", "ipv6CidrBlock": { "Fn::Select": [ @@ -1425,7 +1457,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.SubnetV2", + "fqn": "@aws-cdk/aws-ec2-alpha.SubnetV2", "version": "0.0.0" } }, @@ -1458,44 +1490,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.NatGateway", - "version": "0.0.0" - } - }, - "testNATGWRoute": { - "id": "testNATGWRoute", - "path": "aws-cdk-routev2-privatenatgw-alpha/testNATGWRoute", - "children": { - "Route": { - "id": "Route", - "path": "aws-cdk-routev2-privatenatgw-alpha/testNATGWRoute/Route", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::Route", - "aws:cdk:cloudformation:props": { - "destinationCidrBlock": "0.0.0.0/0", - "destinationIpv6CidrBlock": "0.0.0.0/0", - "natGatewayId": { - "Fn::GetAtt": [ - "testNATgwNATGateway1533420D", - "NatGatewayId" - ] - }, - "routeTableId": { - "Fn::GetAtt": [ - "TestRoottableRouteTableFA28AA38", - "RouteTableId" - ] - } - } - }, - "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", - "version": "0.0.0" - } - } - }, - "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.Route", + "fqn": "@aws-cdk/aws-ec2-alpha.NatGateway", "version": "0.0.0" } }, @@ -1568,7 +1563,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VpcV2", + "fqn": "@aws-cdk/aws-ec2-alpha.VpcV2", "version": "0.0.0" } }, @@ -1597,7 +1592,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.RouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -1612,7 +1607,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "us-west-1a", + "availabilityZone": "us-east-1a", "cidrBlock": "10.0.0.0/24", "ipv6CidrBlock": { "Fn::Select": [ @@ -1670,7 +1665,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.SubnetV2", + "fqn": "@aws-cdk/aws-ec2-alpha.SubnetV2", "version": "0.0.0" } }, @@ -1743,7 +1738,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VpcV2", + "fqn": "@aws-cdk/aws-ec2-alpha.VpcV2", "version": "0.0.0" } }, @@ -1772,7 +1767,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.RouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -1787,7 +1782,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "us-west-1a", + "availabilityZone": "us-east-1a", "cidrBlock": "10.0.0.0/24", "ipv6CidrBlock": { "Fn::Select": [ @@ -1845,7 +1840,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.SubnetV2", + "fqn": "@aws-cdk/aws-ec2-alpha.SubnetV2", "version": "0.0.0" } }, @@ -1918,7 +1913,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.VpcV2", + "fqn": "@aws-cdk/aws-ec2-alpha.VpcV2", "version": "0.0.0" } }, @@ -1944,10 +1939,18 @@ "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", "version": "0.0.0" } + }, + "dynamoRoute": { + "id": "dynamoRoute", + "path": "aws-cdk-routev2-dynamodbendpoint-alpha/TestRoottable/dynamoRoute", + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.RouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -1962,7 +1965,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "us-west-1a", + "availabilityZone": "us-east-1a", "cidrBlock": "10.0.0.0/24", "ipv6CidrBlock": { "Fn::Select": [ @@ -2020,7 +2023,7 @@ } }, "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.SubnetV2", + "fqn": "@aws-cdk/aws-ec2-alpha.SubnetV2", "version": "0.0.0" } }, @@ -2074,14 +2077,6 @@ "version": "0.0.0" } }, - "testDynamoRoute": { - "id": "testDynamoRoute", - "path": "aws-cdk-routev2-dynamodbendpoint-alpha/testDynamoRoute", - "constructInfo": { - "fqn": "@aws-cdk/aws-vpcv2-alpha.Route", - "version": "0.0.0" - } - }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "aws-cdk-routev2-dynamodbendpoint-alpha/BootstrapVersion", diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.ts b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.ts index 579800e7dfcb3..6f67c317dc783 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.route-v2.ts @@ -12,11 +12,9 @@ import * as vpc_v2 from '../lib/vpc-v2'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as cdk from 'aws-cdk-lib'; import { IpCidr, SubnetV2 } from '../lib/subnet-v2'; -// import { CarrierGateway, TransitGateway } from '../lib/route'; -import { EgressOnlyInternetGateway, InternetGateway, NatConnectivityType, NatGateway, Route, RouteTable, VPNGateway } from '../lib/route'; +import { EgressOnlyInternetGateway, InternetGateway, NatConnectivityType, NatGateway, RouteTable, VPNGateway } from '../lib/route'; import { GatewayVpcEndpoint, GatewayVpcEndpointAwsService, SubnetType, VpnConnectionType } from 'aws-cdk-lib/aws-ec2'; import { Fn } from 'aws-cdk-lib'; -//import { log } from 'console'; // as in unit tests, we use a qualified import, // not bring in individual classes @@ -26,14 +24,12 @@ const app = new cdk.App(); const stacks: {[id: string] : cdk.Stack} = { default: new cdk.Stack(app, 'aws-cdk-routev2-alpha', { stackName: 'DefaultVpcDeploy' }), - // 'cgw': new cdk.Stack(app, 'aws-cdk-routev2-carriergw-alpha', {stackName: 'CarrierGatewayVpc'}), eigw: new cdk.Stack(app, 'aws-cdk-routev2-egressonlyigw-alpha', { stackName: 'EgressOnlyIgwVpc' }), igw: new cdk.Stack(app, 'aws-cdk-routev2-igw-alpha', { stackName: 'InternetGatewayVpc' }), vpgw: new cdk.Stack(app, 'aws-cdk-routev2-virtualprivategw-alpha', { stackName: 'VirtualPrivateGwVpc' }), natgw_pub: new cdk.Stack(app, 'aws-cdk-routev2-publicnatgw-alpha', { stackName: 'NatGwPubVpc' }), natgw_priv: new cdk.Stack(app, 'aws-cdk-routev2-privatenatgw-alpha', { stackName: 'NatGwPrivVpc' }), nif: new cdk.Stack(app, 'aws-cdk-routev2-networkif-alpha', { stackName: 'NetworkInterfaceVpc' }), - // 'tgw': new cdk.Stack(app, 'aws-cdk-routev2-transitgw-alpha', {stackName: 'TransitGwVpc'}), vpcpc: new cdk.Stack(app, 'aws-cdk-routev2-vpcpeerconnection-alpha', { stackName: 'VpcPeerConnection' }), dynamodb: new cdk.Stack(app, 'aws-cdk-routev2-dynamodbendpoint-alpha', { stackName: 'DynamodbEndpointVpc' }), }; @@ -59,7 +55,7 @@ for (const stackName in stacks) { if (stackName == 'eigw') { const subnet = new SubnetV2(stacks[stackName], stackName + 'Subnet', { vpc: vpc, - availabilityZone: 'us-west-1a', + availabilityZone: 'us-east-1a', ipv4CidrBlock: new IpCidr('10.0.0.0/24'), subnetType: SubnetType.PRIVATE_WITH_EGRESS, routeTable: routeTables[stackName], @@ -69,7 +65,7 @@ for (const stackName in stacks) { // use empty ipv6 that doesn't overlap const subnet = new SubnetV2(stacks[stackName], stackName + 'Subnet', { vpc: vpc, - availabilityZone: 'us-west-1a', + availabilityZone: 'us-east-1a', ipv4CidrBlock: new IpCidr('10.0.0.0/24'), ipv6CidrBlock: new IpCidr(Fn.select(0, vpc.ipv6CidrBlocks)), subnetType: SubnetType.PRIVATE_WITH_EGRESS, @@ -82,48 +78,28 @@ for (const stackName in stacks) { const eigw = new EgressOnlyInternetGateway(stacks.eigw, 'testEOIGW', { vpc: vpcs.eigw, }); -new Route(stacks.eigw, 'testEIGWRoute', { - routeTable: routeTables.eigw, - destination: '0.0.0.0/0', - target: { gateway: eigw }, -}); +routeTables.eigw.addRoute('eigwRoute', '::/0', { gateway: eigw }); const igw = new InternetGateway(stacks.igw, 'testIGW', { vpc: vpcs.igw, }); -new Route(stacks.igw, 'testIGWRoute', { - routeTable: routeTables.igw, - destination: '0.0.0.0/0', - target: { gateway: igw }, -}); +routeTables.igw.addRoute('igwRoute', '0.0.0.0/0', { gateway: igw }); const vpgw = new VPNGateway(stacks.vpgw, 'testVPGW', { type: VpnConnectionType.IPSEC_1, vpc: vpcs.vpgw, }); -new Route(stacks.vpgw, 'testVPGWRoute', { - routeTable: routeTables.vpgw, - destination: '0.0.0.0/0', - target: { gateway: vpgw }, -}); +routeTables.vpgw.addRoute('vpgwRoute', '0.0.0.0/0', { gateway: vpgw }); const natGwIgw = new InternetGateway(stacks.natgw_pub, 'testNATgwIGW', { vpc: vpcs.natgw_pub, }); -new Route(stacks.natgw_pub, 'testnatgwigwRoute', { - routeTable: routeTables.natgw_pub, - destination: '242.0.0.0/32', - target: { gateway: natGwIgw }, -}); +routeTables.natgw_pub.addRoute('natGwRoute', '0.0.0.0/0', { gateway: natGwIgw }); const natGwPub = new NatGateway(stacks.natgw_pub, 'testNATgw', { subnet: subnets.natgw_pub, vpc: vpcs.natgw_pub, }); -new Route(stacks.natgw_pub, 'testNATGWRoute', { - routeTable: routeTables.natgw_pub, - destination: '0.0.0.0/0', - target: { gateway: natGwPub }, -}); +routeTables.natgw_pub.addRoute('natGwPubRoute', '0.0.0.0/0', { gateway: natGwPub }); const natGwPriv = new NatGateway(stacks.natgw_priv, 'testNATgw', { subnet: subnets.natgw_priv, @@ -134,22 +110,14 @@ const natGwPriv = new NatGateway(stacks.natgw_priv, 'testNATgw', { '10.0.0.43', '10.0.0.44', '10.0.0.45', ], }); -new Route(stacks.natgw_priv, 'testNATGWRoute', { - routeTable: routeTables.natgw_priv, - destination: '0.0.0.0/0', - target: { gateway: natGwPriv }, -}); +routeTables.natgw_priv.addRoute('natGwPrivRoute', '0.0.0.0/0', { gateway: natGwPriv }); const dynamoEndpoint = new GatewayVpcEndpoint(stacks.dynamodb, 'testDynamoEndpoint', { service: GatewayVpcEndpointAwsService.DYNAMODB, vpc: vpcs.dynamodb, subnets: [subnets.dynamodb], }); -new Route(stacks.dynamodb, 'testDynamoRoute', { - routeTable: routeTables.dynamodb, - destination: '0.0.0.0/0', - target: { endpoint: dynamoEndpoint }, -}); +routeTables.dynamodb.addRoute('dynamoRoute', '0.0.0.0/0', { endpoint: dynamoEndpoint }); var i = 0; for (const stackName in stacks) { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/aws-cdk-vpcv2-alpha-new.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/aws-cdk-vpcv2-alpha-new.assets.json index 8fa7b0508afb2..070df7cb90f26 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/aws-cdk-vpcv2-alpha-new.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/aws-cdk-vpcv2-alpha-new.assets.json @@ -1,7 +1,7 @@ { "version": "36.0.5", "files": { - "936d55c8ae74b8dbe0de8c85d4bec3718ce3f73a71342f5852a5a5586485c23c": { + "22c29b35882bab9f2ff567018bbe3b6ae5bd6ab03a13edcd74d29110d672881a": { "source": { "path": "aws-cdk-vpcv2-alpha-new.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "936d55c8ae74b8dbe0de8c85d4bec3718ce3f73a71342f5852a5a5586485c23c.json", + "objectKey": "22c29b35882bab9f2ff567018bbe3b6ae5bd6ab03a13edcd74d29110d672881a.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/aws-cdk-vpcv2-alpha-new.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/aws-cdk-vpcv2-alpha-new.template.json index f6cffbdb23c5d..a44eea1df7d49 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/aws-cdk-vpcv2-alpha-new.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/aws-cdk-vpcv2-alpha-new.template.json @@ -92,7 +92,10 @@ "Properties": { "RouteTableIds": [ { - "Ref": "testsbubnetRouteTableF40F025B" + "Fn::GetAtt": [ + "testsbubnetRouteTableD0136BEA", + "RouteTableId" + ] } ], "VpnGatewayId": { @@ -120,7 +123,7 @@ "VPCTestIpv6IpamCidrD5C271DD" ] }, - "testsbubnetRouteTableF40F025B": { + "testsbubnetRouteTableD0136BEA": { "Type": "AWS::EC2::RouteTable", "Properties": { "VpcId": { @@ -138,7 +141,10 @@ "Type": "AWS::EC2::SubnetRouteTableAssociation", "Properties": { "RouteTableId": { - "Ref": "testsbubnetRouteTableF40F025B" + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] }, "SubnetId": { "Ref": "testsbubnetSubnet77337845" @@ -241,6 +247,55 @@ "DependsOn": [ "InstanceInstanceRoleE9785DE5" ] + }, + "testIGW8D947AF2": { + "Type": "AWS::EC2::InternetGateway" + }, + "TestRoottableRouteTableFA28AA38": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Fn::GetAtt": [ + "VPCTestFB735C86", + "VpcId" + ] + } + } + }, + "TestRoottableeigwRouteF867084E": { + "Type": "AWS::EC2::Route", + "Properties": { + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Fn::GetAtt": [ + "testIGW8D947AF2", + "InternetGatewayId" + ] + }, + "RouteTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "TestRoottableeigwRouteGWAttachmentDECE87B9": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Fn::GetAtt": [ + "testIGW8D947AF2", + "InternetGatewayId" + ] + }, + "VpcId": { + "Fn::GetAtt": [ + "VPCTestFB735C86", + "VpcId" + ] + } + } } }, "Parameters": { diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/manifest.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/manifest.json index f6b54e8178156..8d506ab5c90e8 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/manifest.json @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/936d55c8ae74b8dbe0de8c85d4bec3718ce3f73a71342f5852a5a5586485c23c.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/22c29b35882bab9f2ff567018bbe3b6ae5bd6ab03a13edcd74d29110d672881a.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -88,16 +88,19 @@ "data": "testsbubnetSubnet77337845" } ], - "/aws-cdk-vpcv2-alpha-new/testsbubnet/RouteTable": [ + "/aws-cdk-vpcv2-alpha-new/testsbubnet/RouteTable/RouteTable": [ { "type": "aws:cdk:logicalId", - "data": "testsbubnetRouteTableF40F025B" + "data": "testsbubnetRouteTableD0136BEA" } ], "/aws-cdk-vpcv2-alpha-new/testsbubnet/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", - "data": "testsbubnetRouteTableAssociationD6D083FA" + "data": "testsbubnetRouteTableAssociationD6D083FA", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-cdk-vpcv2-alpha-new/Instance/InstanceSecurityGroup/Resource": [ @@ -130,6 +133,30 @@ "data": "SsmParameterValueawsserviceamiamazonlinuxlatestamznamihvmx8664gp2C96584B6F00A464EAD1953AFF4B05118Parameter" } ], + "/aws-cdk-vpcv2-alpha-new/testIGW/IGW": [ + { + "type": "aws:cdk:logicalId", + "data": "testIGW8D947AF2" + } + ], + "/aws-cdk-vpcv2-alpha-new/TestRoottable/RouteTable": [ + { + "type": "aws:cdk:logicalId", + "data": "TestRoottableRouteTableFA28AA38" + } + ], + "/aws-cdk-vpcv2-alpha-new/TestRoottable/eigwRoute/Route": [ + { + "type": "aws:cdk:logicalId", + "data": "TestRoottableeigwRouteF867084E" + } + ], + "/aws-cdk-vpcv2-alpha-new/TestRoottable/eigwRoute/GWAttachment": [ + { + "type": "aws:cdk:logicalId", + "data": "TestRoottableeigwRouteGWAttachmentDECE87B9" + } + ], "/aws-cdk-vpcv2-alpha-new/BootstrapVersion": [ { "type": "aws:cdk:logicalId", @@ -141,6 +168,15 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "testsbubnetRouteTableF40F025B": [ + { + "type": "aws:cdk:logicalId", + "data": "testsbubnetRouteTableF40F025B", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-vpcv2-alpha-new" diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/tree.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/tree.json index f1f62b0a8a30e..52007fe15dc43 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.js.snapshot/tree.json @@ -190,7 +190,10 @@ "aws:cdk:cloudformation:props": { "routeTableIds": [ { - "Ref": "testsbubnetRouteTableF40F025B" + "Fn::GetAtt": [ + "testsbubnetRouteTableD0136BEA", + "RouteTableId" + ] } ], "vpnGatewayId": { @@ -246,19 +249,29 @@ "RouteTable": { "id": "RouteTable", "path": "aws-cdk-vpcv2-alpha-new/testsbubnet/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Fn::GetAtt": [ - "VPCTestFB735C86", - "VpcId" - ] + "children": { + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-vpcv2-alpha-new/testsbubnet/RouteTable/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Fn::GetAtt": [ + "VPCTestFB735C86", + "VpcId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -269,7 +282,10 @@ "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { "routeTableId": { - "Ref": "testsbubnetRouteTableF40F025B" + "Fn::GetAtt": [ + "testsbubnetRouteTableD0136BEA", + "RouteTableId" + ] }, "subnetId": { "Ref": "testsbubnetSubnet77337845" @@ -464,6 +480,118 @@ "version": "0.0.0" } }, + "testIGW": { + "id": "testIGW", + "path": "aws-cdk-vpcv2-alpha-new/testIGW", + "children": { + "IGW": { + "id": "IGW", + "path": "aws-cdk-vpcv2-alpha-new/testIGW/IGW", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::InternetGateway", + "aws:cdk:cloudformation:props": {} + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnInternetGateway", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2-alpha.InternetGateway", + "version": "0.0.0" + } + }, + "TestRoottable": { + "id": "TestRoottable", + "path": "aws-cdk-vpcv2-alpha-new/TestRoottable", + "children": { + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-vpcv2-alpha-new/TestRoottable/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Fn::GetAtt": [ + "VPCTestFB735C86", + "VpcId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" + } + }, + "eigwRoute": { + "id": "eigwRoute", + "path": "aws-cdk-vpcv2-alpha-new/TestRoottable/eigwRoute", + "children": { + "Route": { + "id": "Route", + "path": "aws-cdk-vpcv2-alpha-new/TestRoottable/eigwRoute/Route", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::Route", + "aws:cdk:cloudformation:props": { + "destinationCidrBlock": "0.0.0.0/0", + "gatewayId": { + "Fn::GetAtt": [ + "testIGW8D947AF2", + "InternetGatewayId" + ] + }, + "routeTableId": { + "Fn::GetAtt": [ + "TestRoottableRouteTableFA28AA38", + "RouteTableId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRoute", + "version": "0.0.0" + } + }, + "GWAttachment": { + "id": "GWAttachment", + "path": "aws-cdk-vpcv2-alpha-new/TestRoottable/eigwRoute/GWAttachment", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::VPCGatewayAttachment", + "aws:cdk:cloudformation:props": { + "internetGatewayId": { + "Fn::GetAtt": [ + "testIGW8D947AF2", + "InternetGatewayId" + ] + }, + "vpcId": { + "Fn::GetAtt": [ + "VPCTestFB735C86", + "VpcId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnVPCGatewayAttachment", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.Resource", + "version": "0.0.0" + } + } + }, + "constructInfo": { + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", + "version": "0.0.0" + } + }, "BootstrapVersion": { "id": "BootstrapVersion", "path": "aws-cdk-vpcv2-alpha-new/BootstrapVersion", diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.ts b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.ts index 529b1cdcc5f40..93d248ebc797a 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.subnet-v2.ts @@ -10,7 +10,7 @@ import * as vpc_v2 from '../lib/vpc-v2'; import * as ec2 from 'aws-cdk-lib/aws-ec2'; -import { AddressFamily, AwsServiceName, IpCidr, Ipam, IpamPoolPublicIpSource, SubnetV2 } from '../lib'; +import { AddressFamily, AwsServiceName, InternetGateway, IpCidr, Ipam, IpamPoolPublicIpSource, RouteTable, SubnetV2 } from '../lib'; import { IntegTest } from '@aws-cdk/integ-tests-alpha'; import * as cdk from 'aws-cdk-lib'; import { SubnetType } from 'aws-cdk-lib/aws-ec2'; @@ -51,7 +51,7 @@ const vpc = new vpc_v2.VpcV2(stack, 'VPCTest', { * can assign IPv6 address only after the allocation * uncomment ipv6CidrBlock and provide valid IPv6 range */ -new SubnetV2(stack, 'testsbubnet', { +const mySubnet = new SubnetV2(stack, 'testsbubnet', { vpc, availabilityZone: 'eu-west-2a', ipv4CidrBlock: new IpCidr('10.0.0.0/24'), @@ -67,12 +67,26 @@ vpc.enableVpnGateway({ type: 'ipsec.1', }); +/**Test compatibility with existing construct */ new ec2.Instance(stack, 'Instance', { vpc, instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO), machineImage: new ec2.AmazonLinuxImage(), }); +/** Test route table association */ + +const igw = new InternetGateway(stack, 'testIGW', { + vpc, +}); + +const routeTable = new RouteTable(stack, 'TestRoottable', { + vpc, +}); + +routeTable.addRoute('eigwRoute', '0.0.0.0/0', { gateway: igw }); +mySubnet.associateRouteTable(routeTable); + new IntegTest(app, 'integtest-model', { testCases: [stack], }); diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/aws-cdk-vpcv2-alpha.assets.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/aws-cdk-vpcv2-alpha.assets.json index edea907079f09..9fad60783195d 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/aws-cdk-vpcv2-alpha.assets.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/aws-cdk-vpcv2-alpha.assets.json @@ -1,7 +1,7 @@ { "version": "36.0.5", "files": { - "a7489230071452bf2d95e6aff482ada8c6c5139402293c5aadfaa9821bd931a0": { + "05dd5343aac11e069ac1e728ef6bc8fd02caae9a5c84c5723ddf8735bca3ba99": { "source": { "path": "aws-cdk-vpcv2-alpha.template.json", "packaging": "file" @@ -9,7 +9,7 @@ "destinations": { "current_account-current_region": { "bucketName": "cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}", - "objectKey": "a7489230071452bf2d95e6aff482ada8c6c5139402293c5aadfaa9821bd931a0.json", + "objectKey": "05dd5343aac11e069ac1e728ef6bc8fd02caae9a5c84c5723ddf8735bca3ba99.json", "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-file-publishing-role-${AWS::AccountId}-${AWS::Region}" } } diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/aws-cdk-vpcv2-alpha.template.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/aws-cdk-vpcv2-alpha.template.json index 69b67454af10b..89f42c48a94df 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/aws-cdk-vpcv2-alpha.template.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/aws-cdk-vpcv2-alpha.template.json @@ -5,7 +5,7 @@ "Properties": { "OperatingRegions": [ { - "RegionName": "eu-central-1" + "RegionName": "ap-south-1" } ] } @@ -20,7 +20,7 @@ "PrivateDefaultScopeId" ] }, - "Locale": "eu-central-1", + "Locale": "ap-south-1", "ProvisionedCidrs": [ { "Cidr": "10.2.0.0/16" @@ -39,7 +39,7 @@ "PublicDefaultScopeId" ] }, - "Locale": "eu-central-1", + "Locale": "ap-south-1", "PublicIpSource": "amazon" } }, @@ -152,7 +152,7 @@ "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "eu-central-1a", + "AvailabilityZone": "ap-south-1a", "CidrBlock": "10.1.0.0/24", "VpcId": { "Fn::GetAtt": [ @@ -167,7 +167,7 @@ "Vpcintegtest2SecondaryAddress36FC60BBC" ] }, - "testsbubnetRouteTableF40F025B": { + "testsbubnetRouteTableD0136BEA": { "Type": "AWS::EC2::RouteTable", "Properties": { "VpcId": { @@ -187,7 +187,10 @@ "Type": "AWS::EC2::SubnetRouteTableAssociation", "Properties": { "RouteTableId": { - "Ref": "testsbubnetRouteTableF40F025B" + "Fn::GetAtt": [ + "testsbubnetRouteTableD0136BEA", + "RouteTableId" + ] }, "SubnetId": { "Ref": "testsbubnetSubnet77337845" @@ -203,7 +206,7 @@ "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "eu-central-1b", + "AvailabilityZone": "ap-south-1b", "CidrBlock": "10.2.0.0/24", "VpcId": { "Fn::GetAtt": [ @@ -218,7 +221,7 @@ "Vpcintegtest2SecondaryAddress36FC60BBC" ] }, - "testsubnetRouteTable55223C61": { + "testsubnetRouteTable682580B2": { "Type": "AWS::EC2::RouteTable", "Properties": { "VpcId": { @@ -238,7 +241,10 @@ "Type": "AWS::EC2::SubnetRouteTableAssociation", "Properties": { "RouteTableId": { - "Ref": "testsubnetRouteTable55223C61" + "Fn::GetAtt": [ + "testsubnetRouteTable682580B2", + "RouteTableId" + ] }, "SubnetId": { "Ref": "testsubnetSubnetDD417829" @@ -254,7 +260,7 @@ "Type": "AWS::EC2::Subnet", "Properties": { "AssignIpv6AddressOnCreation": false, - "AvailabilityZone": "eu-central-1b", + "AvailabilityZone": "ap-south-1b", "CidrBlock": "10.3.0.0/24", "VpcId": { "Fn::GetAtt": [ @@ -269,7 +275,7 @@ "Vpcintegtest2SecondaryAddress36FC60BBC" ] }, - "validateIpv6RouteTable10861B00": { + "validateIpv6RouteTable09389F8D": { "Type": "AWS::EC2::RouteTable", "Properties": { "VpcId": { @@ -289,7 +295,10 @@ "Type": "AWS::EC2::SubnetRouteTableAssociation", "Properties": { "RouteTableId": { - "Ref": "validateIpv6RouteTable10861B00" + "Fn::GetAtt": [ + "validateIpv6RouteTable09389F8D", + "RouteTableId" + ] }, "SubnetId": { "Ref": "validateIpv6Subnet07BD40AE" diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/manifest.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/manifest.json index 07729bcb92768..be86401dbd136 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/manifest.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/manifest.json @@ -18,7 +18,7 @@ "validateOnSynth": false, "assumeRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-deploy-role-${AWS::AccountId}-${AWS::Region}", "cloudFormationExecutionRoleArn": "arn:${AWS::Partition}:iam::${AWS::AccountId}:role/cdk-hnb659fds-cfn-exec-role-${AWS::AccountId}-${AWS::Region}", - "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/a7489230071452bf2d95e6aff482ada8c6c5139402293c5aadfaa9821bd931a0.json", + "stackTemplateAssetObjectUrl": "s3://cdk-hnb659fds-assets-${AWS::AccountId}-${AWS::Region}/05dd5343aac11e069ac1e728ef6bc8fd02caae9a5c84c5723ddf8735bca3ba99.json", "requiresBootstrapStackVersion": 6, "bootstrapStackVersionSsmParameter": "/cdk-bootstrap/hnb659fds/version", "additionalDependencies": [ @@ -43,19 +43,28 @@ "/aws-cdk-vpcv2-alpha/IpamTest/PrivatePool0/PrivatePool0": [ { "type": "aws:cdk:logicalId", - "data": "IpamTestPrivatePool039C763DC" + "data": "IpamTestPrivatePool039C763DC", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-cdk-vpcv2-alpha/IpamTest/PublicPool0/PublicPool0": [ { "type": "aws:cdk:logicalId", - "data": "IpamTestPublicPool0C44B7C49" + "data": "IpamTestPublicPool0C44B7C49", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-cdk-vpcv2-alpha/IpamTest/PublicPool0/PublicPool0Cidr": [ { "type": "aws:cdk:logicalId", - "data": "IpamTestPublicPool0PublicPool0CidrC57CE00C" + "data": "IpamTestPublicPool0PublicPool0CidrC57CE00C", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-cdk-vpcv2-alpha/VPC-integ-test-1/Resource": [ @@ -67,7 +76,10 @@ "/aws-cdk-vpcv2-alpha/VPC-integ-test-1/ipv4IpamCidr": [ { "type": "aws:cdk:logicalId", - "data": "VPCintegtest1ipv4IpamCidr8105B4E4" + "data": "VPCintegtest1ipv4IpamCidr8105B4E4", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-cdk-vpcv2-alpha/VPC-integ-test-1/AmazonProvided": [ @@ -85,7 +97,10 @@ "/aws-cdk-vpcv2-alpha/Vpc-integ-test-2/Ipv6IpamCidr": [ { "type": "aws:cdk:logicalId", - "data": "Vpcintegtest2Ipv6IpamCidrFF84EC2B" + "data": "Vpcintegtest2Ipv6IpamCidrFF84EC2B", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-cdk-vpcv2-alpha/Vpc-integ-test-2/SecondaryAddress2": [ @@ -103,55 +118,73 @@ "/aws-cdk-vpcv2-alpha/testsbubnet/Subnet": [ { "type": "aws:cdk:logicalId", - "data": "testsbubnetSubnet77337845" + "data": "testsbubnetSubnet77337845", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], - "/aws-cdk-vpcv2-alpha/testsbubnet/RouteTable": [ + "/aws-cdk-vpcv2-alpha/testsbubnet/RouteTable/RouteTable": [ { "type": "aws:cdk:logicalId", - "data": "testsbubnetRouteTableF40F025B" + "data": "testsbubnetRouteTableD0136BEA" } ], "/aws-cdk-vpcv2-alpha/testsbubnet/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", - "data": "testsbubnetRouteTableAssociationD6D083FA" + "data": "testsbubnetRouteTableAssociationD6D083FA", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-cdk-vpcv2-alpha/testsubnet/Subnet": [ { "type": "aws:cdk:logicalId", - "data": "testsubnetSubnetDD417829" + "data": "testsubnetSubnetDD417829", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], - "/aws-cdk-vpcv2-alpha/testsubnet/RouteTable": [ + "/aws-cdk-vpcv2-alpha/testsubnet/RouteTable/RouteTable": [ { "type": "aws:cdk:logicalId", - "data": "testsubnetRouteTable55223C61" + "data": "testsubnetRouteTable682580B2" } ], "/aws-cdk-vpcv2-alpha/testsubnet/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", - "data": "testsubnetRouteTableAssociationC106676D" + "data": "testsubnetRouteTableAssociationC106676D", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-cdk-vpcv2-alpha/validateIpv6/Subnet": [ { "type": "aws:cdk:logicalId", - "data": "validateIpv6Subnet07BD40AE" + "data": "validateIpv6Subnet07BD40AE", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], - "/aws-cdk-vpcv2-alpha/validateIpv6/RouteTable": [ + "/aws-cdk-vpcv2-alpha/validateIpv6/RouteTable/RouteTable": [ { "type": "aws:cdk:logicalId", - "data": "validateIpv6RouteTable10861B00" + "data": "validateIpv6RouteTable09389F8D" } ], "/aws-cdk-vpcv2-alpha/validateIpv6/RouteTableAssociation": [ { "type": "aws:cdk:logicalId", - "data": "validateIpv6RouteTableAssociationD6330457" + "data": "validateIpv6RouteTableAssociationD6330457", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_REPLACE" + ] } ], "/aws-cdk-vpcv2-alpha/BootstrapVersion": [ @@ -165,6 +198,33 @@ "type": "aws:cdk:logicalId", "data": "CheckBootstrapVersion" } + ], + "testsbubnetRouteTableF40F025B": [ + { + "type": "aws:cdk:logicalId", + "data": "testsbubnetRouteTableF40F025B", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "testsubnetRouteTable55223C61": [ + { + "type": "aws:cdk:logicalId", + "data": "testsubnetRouteTable55223C61", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } + ], + "validateIpv6RouteTable10861B00": [ + { + "type": "aws:cdk:logicalId", + "data": "validateIpv6RouteTable10861B00", + "trace": [ + "!!DESTRUCTIVE_CHANGES: WILL_DESTROY" + ] + } ] }, "displayName": "aws-cdk-vpcv2-alpha" diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/tree.json b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/tree.json index 4ef8722255a1d..923e868905d52 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/tree.json +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.js.snapshot/tree.json @@ -20,7 +20,7 @@ "aws:cdk:cloudformation:props": { "operatingRegions": [ { - "regionName": "eu-central-1" + "regionName": "ap-south-1" } ] } @@ -47,7 +47,7 @@ "PrivateDefaultScopeId" ] }, - "locale": "eu-central-1", + "locale": "ap-south-1", "provisionedCidrs": [ { "cidr": "10.2.0.0/16" @@ -84,7 +84,7 @@ "PublicDefaultScopeId" ] }, - "locale": "eu-central-1", + "locale": "ap-south-1", "publicIpSource": "amazon" } }, @@ -302,7 +302,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "eu-central-1a", + "availabilityZone": "ap-south-1a", "cidrBlock": "10.1.0.0/24", "vpcId": { "Fn::GetAtt": [ @@ -328,19 +328,29 @@ "RouteTable": { "id": "RouteTable", "path": "aws-cdk-vpcv2-alpha/testsbubnet/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Fn::GetAtt": [ - "Vpcintegtest20DAD8F9D", - "VpcId" - ] + "children": { + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-vpcv2-alpha/testsbubnet/RouteTable/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Fn::GetAtt": [ + "Vpcintegtest20DAD8F9D", + "VpcId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -351,7 +361,10 @@ "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { "routeTableId": { - "Ref": "testsbubnetRouteTableF40F025B" + "Fn::GetAtt": [ + "testsbubnetRouteTableD0136BEA", + "RouteTableId" + ] }, "subnetId": { "Ref": "testsbubnetSubnet77337845" @@ -380,7 +393,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "eu-central-1b", + "availabilityZone": "ap-south-1b", "cidrBlock": "10.2.0.0/24", "vpcId": { "Fn::GetAtt": [ @@ -406,19 +419,29 @@ "RouteTable": { "id": "RouteTable", "path": "aws-cdk-vpcv2-alpha/testsubnet/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Fn::GetAtt": [ - "Vpcintegtest20DAD8F9D", - "VpcId" - ] + "children": { + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-vpcv2-alpha/testsubnet/RouteTable/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Fn::GetAtt": [ + "Vpcintegtest20DAD8F9D", + "VpcId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -429,7 +452,10 @@ "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { "routeTableId": { - "Ref": "testsubnetRouteTable55223C61" + "Fn::GetAtt": [ + "testsubnetRouteTable682580B2", + "RouteTableId" + ] }, "subnetId": { "Ref": "testsubnetSubnetDD417829" @@ -458,7 +484,7 @@ "aws:cdk:cloudformation:type": "AWS::EC2::Subnet", "aws:cdk:cloudformation:props": { "assignIpv6AddressOnCreation": false, - "availabilityZone": "eu-central-1b", + "availabilityZone": "ap-south-1b", "cidrBlock": "10.3.0.0/24", "vpcId": { "Fn::GetAtt": [ @@ -484,19 +510,29 @@ "RouteTable": { "id": "RouteTable", "path": "aws-cdk-vpcv2-alpha/validateIpv6/RouteTable", - "attributes": { - "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", - "aws:cdk:cloudformation:props": { - "vpcId": { - "Fn::GetAtt": [ - "Vpcintegtest20DAD8F9D", - "VpcId" - ] + "children": { + "RouteTable": { + "id": "RouteTable", + "path": "aws-cdk-vpcv2-alpha/validateIpv6/RouteTable/RouteTable", + "attributes": { + "aws:cdk:cloudformation:type": "AWS::EC2::RouteTable", + "aws:cdk:cloudformation:props": { + "vpcId": { + "Fn::GetAtt": [ + "Vpcintegtest20DAD8F9D", + "VpcId" + ] + } + } + }, + "constructInfo": { + "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "version": "0.0.0" } } }, "constructInfo": { - "fqn": "aws-cdk-lib.aws_ec2.CfnRouteTable", + "fqn": "@aws-cdk/aws-ec2-alpha.RouteTable", "version": "0.0.0" } }, @@ -507,7 +543,10 @@ "aws:cdk:cloudformation:type": "AWS::EC2::SubnetRouteTableAssociation", "aws:cdk:cloudformation:props": { "routeTableId": { - "Ref": "validateIpv6RouteTable10861B00" + "Fn::GetAtt": [ + "validateIpv6RouteTable09389F8D", + "RouteTableId" + ] }, "subnetId": { "Ref": "validateIpv6Subnet07BD40AE" diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.ts b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.ts index b4174e8e3d2aa..17d1837b24390 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/test/integ.vpc-v2-alpha.ts @@ -20,7 +20,7 @@ const app = new cdk.App(); const stack = new cdk.Stack(app, 'aws-cdk-vpcv2-alpha'); const ipam = new Ipam(stack, 'IpamTest', { - operatingRegion: ['eu-central-1'], + operatingRegion: ['ap-south-1'], }); /**Test Ipam Pool Ipv4 */ @@ -28,13 +28,13 @@ const ipam = new Ipam(stack, 'IpamTest', { const pool1 = ipam.privateScope.addPool('PrivatePool0', { addressFamily: AddressFamily.IP_V4, ipv4ProvisionedCidrs: ['10.2.0.0/16'], - locale: 'eu-central-1', + locale: 'ap-south-1', }); const pool2 = ipam.publicScope.addPool('PublicPool0', { addressFamily: AddressFamily.IP_V6, awsService: AwsServiceName.EC2, - locale: 'eu-central-1', + locale: 'ap-south-1', publicIpSource: IpamPoolPublicIpSource.AMAZON, }); pool2.provisionCidr('PublicPool0Cidr', { netmaskLength: 52 } ); @@ -78,14 +78,14 @@ const vpc = new vpc_v2.VpcV2(stack, 'Vpc-integ-test-2', { new SubnetV2(stack, 'testsbubnet', { vpc, - availabilityZone: 'eu-central-1a', + availabilityZone: 'ap-south-1a', ipv4CidrBlock: new IpCidr('10.1.0.0/24'), subnetType: SubnetType.PRIVATE_ISOLATED, }); new SubnetV2(stack, 'testsubnet', { vpc, - availabilityZone: 'eu-central-1b', + availabilityZone: 'ap-south-1b', ipv4CidrBlock: new IpCidr('10.2.0.0/24'), //Test secondary ipv6 address after IPAM pool creation //ipv6CidrBlock: new Ipv6Cidr('2001:db8:1::/64'), @@ -96,7 +96,7 @@ new SubnetV2(stack, 'testsubnet', { new SubnetV2(stack, 'validateIpv6', { vpc, ipv4CidrBlock: new IpCidr('10.3.0.0/24'), - availabilityZone: 'eu-central-1b', + availabilityZone: 'ap-south-1b', //Test secondary ipv6 address after IPAM pool creation //ipv6CidrBlock: new Ipv6Cidr('2001:db8::/48'), subnetType: SubnetType.PRIVATE_ISOLATED, diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/route.test.ts b/packages/@aws-cdk/aws-ec2-alpha/test/route.test.ts index e5dc355fc1aea..8070fe093c80a 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/route.test.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/test/route.test.ts @@ -43,41 +43,29 @@ describe('EC2 Routing', () => { const eigw = new route.EgressOnlyInternetGateway(stack, 'TestEIGW', { vpc: myVpc, }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { gateway: eigw }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // EIGW should be in stack - TestEIGW4E4CDA8D: { - Type: 'AWS::EC2::EgressOnlyInternetGateway', - Properties: { - VpcId: { - 'Fn::GetAtt': [ - 'TestVpcE77CE678', 'VpcId', - ], - }, - }, - }, - // Route linking IP to EIGW should be in stack - TestRoute4CB59404: { - Type: 'AWS::EC2::Route', - Properties: { - DestinationCidrBlock: '0.0.0.0/0', - EgressOnlyInternetGatewayId: { - 'Fn::GetAtt': [ - 'TestEIGW4E4CDA8D', 'Id', - ], - }, - RouteTableId: { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', 'RouteTableId', - ], - }, - }, - }, + routeTable.addRoute('Route', '::/0', { gateway: eigw }); + + const template = Template.fromStack(stack); + // EIGW should be in stack + template.hasResourceProperties('AWS::EC2::EgressOnlyInternetGateway', { + VpcId: { + 'Fn::GetAtt': [ + 'TestVpcE77CE678', 'VpcId', + ], + }, + }); + // Route linking IP to EIGW should be in stack + template.hasResourceProperties('AWS::EC2::Route', { + DestinationCidrBlock: '::/0', + EgressOnlyInternetGatewayId: { + 'Fn::GetAtt': [ + 'TestEIGW4E4CDA8D', 'Id', + ], + }, + RouteTableId: { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', 'RouteTableId', + ], }, }); }); @@ -87,53 +75,37 @@ describe('EC2 Routing', () => { type: VpnConnectionType.IPSEC_1, vpc: myVpc, }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { gateway: vpngw }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // VPN Gateway should be in stack - TestVpnGwIGW11AF5344: { - Type: 'AWS::EC2::VPNGateway', - Properties: { - Type: 'ipsec.1', - }, - }, - // Route linking IP to VPN GW should be in stack - TestRoute4CB59404: { - Type: 'AWS::EC2::Route', - Properties: { - DestinationCidrBlock: '0.0.0.0/0', - GatewayId: { - 'Fn::GetAtt': [ - 'TestVpnGwIGW11AF5344', 'VPNGatewayId', - ], - }, - RouteTableId: { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', 'RouteTableId', - ], - }, - }, - }, - // Route Gateway attachment should be in stack - TestRouteGWAttachmentDD69361B: { - Type: 'AWS::EC2::VPCGatewayAttachment', - Properties: { - VpcId: { - 'Fn::GetAtt': [ - 'TestVpcE77CE678', 'VpcId', - ], - }, - VpnGatewayId: { - 'Fn::GetAtt': [ - 'TestVpnGwIGW11AF5344', 'VPNGatewayId', - ], - }, - }, - }, + routeTable.addRoute('Route', '0.0.0.0/0', { gateway: vpngw }); + const template = Template.fromStack(stack); + // VPN Gateway should be in stack + template.hasResourceProperties('AWS::EC2::VPNGateway', { + Type: 'ipsec.1', + }); + // Route linking IP to VPN GW should be in stack + template.hasResourceProperties('AWS::EC2::Route', { + DestinationCidrBlock: '0.0.0.0/0', + GatewayId: { + 'Fn::GetAtt': [ + 'TestVpnGwIGW11AF5344', 'VPNGatewayId', + ], + }, + RouteTableId: { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', 'RouteTableId', + ], + }, + }); + // Route Gateway attachment should be in stack + template.hasResourceProperties('AWS::EC2::VPCGatewayAttachment', { + VpcId: { + 'Fn::GetAtt': [ + 'TestVpcE77CE678', 'VpcId', + ], + }, + VpnGatewayId: { + 'Fn::GetAtt': [ + 'TestVpnGwIGW11AF5344', 'VPNGatewayId', + ], }, }); }), @@ -144,17 +116,10 @@ describe('EC2 Routing', () => { vpc: myVpc, amazonSideAsn: 12345678, }); - Template.fromStack(stack).templateMatches({ - Resources: { - // VPN Gateway should be in stack - TestVpnGwIGW11AF5344: { - Type: 'AWS::EC2::VPNGateway', - Properties: { - AmazonSideAsn: 12345678, - Type: 'ipsec.1', - }, - }, - }, + // VPN Gateway should be in stack + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPNGateway', { + AmazonSideAsn: 12345678, + Type: 'ipsec.1', }); }), @@ -162,50 +127,35 @@ describe('EC2 Routing', () => { const igw = new route.InternetGateway(stack, 'TestIGW', { vpc: myVpc, }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { gateway: igw }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // Internet Gateway should be in stack - TestIGW1B4DB37D: { - Type: 'AWS::EC2::InternetGateway', - }, - // Route linking IP to IGW should be in stack - TestRoute4CB59404: { - Type: 'AWS::EC2::Route', - Properties: { - DestinationCidrBlock: '0.0.0.0/0', - GatewayId: { - 'Fn::GetAtt': [ - 'TestIGW1B4DB37D', 'InternetGatewayId', - ], - }, - RouteTableId: { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', 'RouteTableId', - ], - }, - }, - }, - // Route Gateway attachment should be in stack - TestRouteGWAttachmentDD69361B: { - Type: 'AWS::EC2::VPCGatewayAttachment', - Properties: { - InternetGatewayId: { - 'Fn::GetAtt': [ - 'TestIGW1B4DB37D', 'InternetGatewayId', - ], - }, - VpcId: { - 'Fn::GetAtt': [ - 'TestVpcE77CE678', 'VpcId', - ], - }, - }, - }, + routeTable.addRoute('Route', '0.0.0.0/0', { gateway: igw }); + const template = Template.fromStack(stack); + // Internet Gateway should be in stack + template.hasResource('AWS::EC2::InternetGateway', {}); + // Route linking IP to IGW should be in stack + template.hasResourceProperties('AWS::EC2::Route', { + DestinationCidrBlock: '0.0.0.0/0', + GatewayId: { + 'Fn::GetAtt': [ + 'TestIGW1B4DB37D', 'InternetGatewayId', + ], + }, + RouteTableId: { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', 'RouteTableId', + ], + }, + }); + // Route Gateway attachment should be in stack + template.hasResourceProperties('AWS::EC2::VPCGatewayAttachment', { + VpcId: { + 'Fn::GetAtt': [ + 'TestVpcE77CE678', 'VpcId', + ], + }, + InternetGatewayId: { + 'Fn::GetAtt': [ + 'TestIGW1B4DB37D', 'InternetGatewayId', + ], }, }); }); @@ -216,47 +166,35 @@ describe('EC2 Routing', () => { connectivityType: route.NatConnectivityType.PRIVATE, privateIpAddress: '10.0.0.42', }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { gateway: natgw }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // NAT Gateway should be in stack - TestNATGWNATGatewayBE4F6F2D: { - Type: 'AWS::EC2::NatGateway', - Properties: { - ConnectivityType: 'private', - PrivateIpAddress: '10.0.0.42', - SubnetId: { - Ref: 'TestSubnet2A4BE4CA', - }, - }, - DependsOn: [ - 'TestSubnetRouteTableAssociationFE267B30', - ], - }, - // Route linking private IP to NAT Gateway should be in stack - TestRoute4CB59404: { - Type: 'AWS::EC2::Route', - Properties: { - DestinationCidrBlock: '0.0.0.0/0', - NatGatewayId: { - 'Fn::GetAtt': [ - 'TestNATGWNATGatewayBE4F6F2D', - 'NatGatewayId', - ], - }, - RouteTableId: { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', - 'RouteTableId', - ], - }, - }, + routeTable.addRoute('Route', '0.0.0.0/0', { gateway: natgw }); + const template = Template.fromStack(stack); + template.hasResource('AWS::EC2::NatGateway', { + Properties: { + ConnectivityType: 'private', + PrivateIpAddress: '10.0.0.42', + SubnetId: { + Ref: 'TestSubnet2A4BE4CA', }, }, + DependsOn: [ + 'TestSubnetRouteTableAssociationFE267B30', + ], + }); + // Route linking private IP to NAT Gateway should be in stack + template.hasResourceProperties('AWS::EC2::Route', { + DestinationCidrBlock: '0.0.0.0/0', + NatGatewayId: { + 'Fn::GetAtt': [ + 'TestNATGWNATGatewayBE4F6F2D', + 'NatGatewayId', + ], + }, + RouteTableId: { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', + 'RouteTableId', + ], + }, }); }); @@ -270,33 +208,24 @@ describe('EC2 Routing', () => { '10.0.2.0/28', ], }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { gateway: natgw }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // NAT Gateway should be in stack - TestNATGWNATGatewayBE4F6F2D: { - Type: 'AWS::EC2::NatGateway', - Properties: { - ConnectivityType: 'private', - PrivateIpAddress: '10.0.0.42', - SecondaryPrivateIpAddresses: [ - '10.0.1.0/28', - '10.0.2.0/28', - ], - SubnetId: { - Ref: 'TestSubnet2A4BE4CA', - }, - }, - DependsOn: [ - 'TestSubnetRouteTableAssociationFE267B30', - ], + routeTable.addRoute('Route', '0.0.0.0/0', { gateway: natgw }); + const template = Template.fromStack(stack); + // NAT Gateway should be in stack + template.hasResource('AWS::EC2::NatGateway', { + Properties: { + ConnectivityType: 'private', + PrivateIpAddress: '10.0.0.42', + SecondaryPrivateIpAddresses: [ + '10.0.1.0/28', + '10.0.2.0/28', + ], + SubnetId: { + Ref: 'TestSubnet2A4BE4CA', }, - }, + DependsOn: [ + 'TestSubnetRouteTableAssociationFE267B30', + ], }); }); @@ -307,48 +236,37 @@ describe('EC2 Routing', () => { privateIpAddress: '10.0.0.42', secondaryPrivateIpAddressCount: 2, }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { gateway: natgw }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // NAT Gateway should be in stack - TestNATGWNATGatewayBE4F6F2D: { - Type: 'AWS::EC2::NatGateway', - Properties: { - ConnectivityType: 'private', - PrivateIpAddress: '10.0.0.42', - SecondaryPrivateIpAddressCount: 2, - SubnetId: { - Ref: 'TestSubnet2A4BE4CA', - }, - }, - DependsOn: [ - 'TestSubnetRouteTableAssociationFE267B30', - ], - }, - // Route linking private IP to NAT Gateway should be in stack - TestRoute4CB59404: { - Type: 'AWS::EC2::Route', - Properties: { - DestinationCidrBlock: '0.0.0.0/0', - NatGatewayId: { - 'Fn::GetAtt': [ - 'TestNATGWNATGatewayBE4F6F2D', - 'NatGatewayId', - ], - }, - RouteTableId: { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', - 'RouteTableId', - ], - }, - }, + routeTable.addRoute('Route', '0.0.0.0/0', { gateway: natgw }); + const template = Template.fromStack(stack); + // NAT Gateway should be in stack + template.hasResource('AWS::EC2::NatGateway', { + Properties: { + ConnectivityType: 'private', + PrivateIpAddress: '10.0.0.42', + SecondaryPrivateIpAddressCount: 2, + SubnetId: { + Ref: 'TestSubnet2A4BE4CA', }, }, + DependsOn: [ + 'TestSubnetRouteTableAssociationFE267B30', + ], + }); + // Route linking private IP to NAT Gateway should be in stack + template.hasResourceProperties('AWS::EC2::Route', { + DestinationCidrBlock: '0.0.0.0/0', + NatGatewayId: { + 'Fn::GetAtt': [ + 'TestNATGWNATGatewayBE4F6F2D', + 'NatGatewayId', + ], + }, + RouteTableId: { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', + 'RouteTableId', + ], + }, }); }); @@ -356,52 +274,40 @@ describe('EC2 Routing', () => { const natgw = new route.NatGateway(stack, 'TestNATGW', { subnet: mySubnet, }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { gateway: natgw }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // NAT Gateway should be in stack - TestNATGWNATGatewayBE4F6F2D: { - Type: 'AWS::EC2::NatGateway', - Properties: { - SubnetId: { - Ref: 'TestSubnet2A4BE4CA', - }, - }, - DependsOn: [ - 'TestSubnetRouteTableAssociationFE267B30', - ], - }, - // Route linking private IP to NAT Gateway should be in stack - TestRoute4CB59404: { - Type: 'AWS::EC2::Route', - Properties: { - DestinationCidrBlock: '0.0.0.0/0', - NatGatewayId: { - 'Fn::GetAtt': [ - 'TestNATGWNATGatewayBE4F6F2D', - 'NatGatewayId', - ], - }, - RouteTableId: { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', - 'RouteTableId', - ], - }, - }, - }, - // EIP should be created when not provided - TestNATGWEIP0A279819: { - Type: 'AWS::EC2::EIP', - DependsOn: [ - 'TestSubnetRouteTableAssociationFE267B30', - ], + routeTable.addRoute('Route', '0.0.0.0/0', { gateway: natgw }); + const template = Template.fromStack(stack); + // NAT Gateway should be in stack + template.hasResource('AWS::EC2::NatGateway', { + Properties: { + SubnetId: { + Ref: 'TestSubnet2A4BE4CA', }, }, + DependsOn: [ + 'TestSubnetRouteTableAssociationFE267B30', + ], + }); + // Route linking private IP to NAT Gateway should be in stack + template.hasResourceProperties('AWS::EC2::Route', { + DestinationCidrBlock: '0.0.0.0/0', + NatGatewayId: { + 'Fn::GetAtt': [ + 'TestNATGWNATGatewayBE4F6F2D', + 'NatGatewayId', + ], + }, + RouteTableId: { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', + 'RouteTableId', + ], + }, + }); + // EIP should be created when not provided + template.hasResource('AWS::EC2::EIP', { + DependsOn: [ + 'TestSubnetRouteTableAssociationFE267B30', + ], }); }); @@ -413,57 +319,42 @@ describe('EC2 Routing', () => { subnet: mySubnet, allocationId: eip.attrAllocationId, }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { gateway: natgw }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // NAT Gateway should be in stack - TestNATGWNATGatewayBE4F6F2D: { - Type: 'AWS::EC2::NatGateway', - Properties: { - SubnetId: { - Ref: 'TestSubnet2A4BE4CA', - }, - }, - DependsOn: [ - 'TestSubnetRouteTableAssociationFE267B30', - ], - }, - // Route linking private IP to NAT Gateway should be in stack - TestRoute4CB59404: { - Type: 'AWS::EC2::Route', - Properties: { - DestinationCidrBlock: '0.0.0.0/0', - NatGatewayId: { - 'Fn::GetAtt': [ - 'TestNATGWNATGatewayBE4F6F2D', - 'NatGatewayId', - ], - }, - RouteTableId: { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', - 'RouteTableId', - ], - }, - }, - }, - // EIP should be in stack - MyEIP: { - Type: 'AWS::EC2::EIP', - Properties: { - Domain: { - 'Fn::GetAtt': [ - 'TestVpcE77CE678', - 'VpcId', - ], - }, - }, + routeTable.addRoute('Route', '0.0.0.0/0', { gateway: natgw }); + const template = Template.fromStack(stack); + template.hasResource('AWS::EC2::NatGateway', { + Properties: { + SubnetId: { + Ref: 'TestSubnet2A4BE4CA', }, }, + DependsOn: [ + 'TestSubnetRouteTableAssociationFE267B30', + ], + }); + // Route linking private IP to NAT Gateway should be in stack + template.hasResourceProperties('AWS::EC2::Route', { + DestinationCidrBlock: '0.0.0.0/0', + NatGatewayId: { + 'Fn::GetAtt': [ + 'TestNATGWNATGatewayBE4F6F2D', + 'NatGatewayId', + ], + }, + RouteTableId: { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', + 'RouteTableId', + ], + }, + }); + // EIP should be in stack + template.hasResourceProperties('AWS::EC2::EIP', { + Domain: { + 'Fn::GetAtt': [ + 'TestVpcE77CE678', + 'VpcId', + ], + }, }); }); @@ -473,60 +364,42 @@ describe('EC2 Routing', () => { connectivityType: route.NatConnectivityType.PUBLIC, maxDrainDuration: cdk.Duration.seconds(2001), }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { gateway: natgw }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // NAT Gateway should be in stack - TestNATGWNATGatewayBE4F6F2D: { - Type: 'AWS::EC2::NatGateway', - Properties: { - AllocationId: { - 'Fn::GetAtt': [ - 'TestNATGWEIP0A279819', - 'AllocationId', - ], - }, - ConnectivityType: 'public', - MaxDrainDurationSeconds: 2001, - SubnetId: { - Ref: 'TestSubnet2A4BE4CA', - }, - }, - DependsOn: [ - 'TestSubnetRouteTableAssociationFE267B30', - ], - }, - // Route linking private IP to NAT Gateway should be in stack - TestRoute4CB59404: { - Type: 'AWS::EC2::Route', - Properties: { - DestinationCidrBlock: '0.0.0.0/0', - NatGatewayId: { - 'Fn::GetAtt': [ - 'TestNATGWNATGatewayBE4F6F2D', - 'NatGatewayId', - ], - }, - RouteTableId: { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', - 'RouteTableId', - ], - }, - }, - }, - // EIP should be created when not provided - TestNATGWEIP0A279819: { - Type: 'AWS::EC2::EIP', - DependsOn: [ - 'TestSubnetRouteTableAssociationFE267B30', - ], + routeTable.addRoute('Route', '0.0.0.0/0', { gateway: natgw }); + const template = Template.fromStack(stack); + // NAT Gateway should be in stack + template.hasResource('AWS::EC2::NatGateway', { + Properties: { + ConnectivityType: 'public', + MaxDrainDurationSeconds: 2001, + SubnetId: { + Ref: 'TestSubnet2A4BE4CA', }, }, + DependsOn: [ + 'TestSubnetRouteTableAssociationFE267B30', + ], + }); + // Route linking private IP to NAT Gateway should be in stack + template.hasResourceProperties('AWS::EC2::Route', { + DestinationCidrBlock: '0.0.0.0/0', + NatGatewayId: { + 'Fn::GetAtt': [ + 'TestNATGWNATGatewayBE4F6F2D', + 'NatGatewayId', + ], + }, + RouteTableId: { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', + 'RouteTableId', + ], + }, + }); + // EIP should be created when not provided + template.hasResource('AWS::EC2::EIP', { + DependsOn: [ + 'TestSubnetRouteTableAssociationFE267B30', + ], }); }); @@ -535,44 +408,33 @@ describe('EC2 Routing', () => { vpc: myVpc, service: GatewayVpcEndpointAwsService.DYNAMODB, }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { endpoint: dynamodb }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // DynamoDB endpoint should be in stack - TestDB27CDA92F: { - Type: 'AWS::EC2::VPCEndpoint', - Properties: { - RouteTableIds: [ - { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', - 'RouteTableId', - ], - }, - ], - ServiceName: { - 'Fn::Join': [ - '', - [ - 'com.amazonaws.', - { Ref: 'AWS::Region' }, - '.dynamodb', - ], - ], - }, - VpcEndpointType: 'Gateway', - VpcId: { - 'Fn::GetAtt': [ - 'TestVpcE77CE678', - 'VpcId', - ], - }, - }, + routeTable.addRoute('Route', '0.0.0.0/0', { endpoint: dynamodb }); + // DynamoDB endpoint should be in stack + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', { + RouteTableIds: [ + { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', + 'RouteTableId', + ], }, + ], + ServiceName: { + 'Fn::Join': [ + '', + [ + 'com.amazonaws.', + { Ref: 'AWS::Region' }, + '.dynamodb', + ], + ], + }, + VpcEndpointType: 'Gateway', + VpcId: { + 'Fn::GetAtt': [ + 'TestVpcE77CE678', + 'VpcId', + ], }, }); }); @@ -582,44 +444,33 @@ describe('EC2 Routing', () => { vpc: myVpc, service: GatewayVpcEndpointAwsService.S3, }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { endpoint: dynamodb }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // S3 endpoint should be in stack - TestS38FCC715C: { - Type: 'AWS::EC2::VPCEndpoint', - Properties: { - RouteTableIds: [ - { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', - 'RouteTableId', - ], - }, - ], - ServiceName: { - 'Fn::Join': [ - '', - [ - 'com.amazonaws.', - { Ref: 'AWS::Region' }, - '.s3', - ], - ], - }, - VpcEndpointType: 'Gateway', - VpcId: { - 'Fn::GetAtt': [ - 'TestVpcE77CE678', - 'VpcId', - ], - }, - }, + routeTable.addRoute('Route', '0.0.0.0/0', { endpoint: dynamodb }); + // S3 endpoint should be in stack + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', { + RouteTableIds: [ + { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', + 'RouteTableId', + ], }, + ], + ServiceName: { + 'Fn::Join': [ + '', + [ + 'com.amazonaws.', + { Ref: 'AWS::Region' }, + '.s3', + ], + ], + }, + VpcEndpointType: 'Gateway', + VpcId: { + 'Fn::GetAtt': [ + 'TestVpcE77CE678', + 'VpcId', + ], }, }); }); @@ -629,44 +480,33 @@ describe('EC2 Routing', () => { vpc: myVpc, service: GatewayVpcEndpointAwsService.S3_EXPRESS, }); - new route.Route(stack, 'TestRoute', { - routeTable: routeTable, - destination: '0.0.0.0/0', - target: { endpoint: dynamodb }, - }); - Template.fromStack(stack).templateMatches({ - Resources: { - // S3 endpoint should be in stack - TestS3E055E5994: { - Type: 'AWS::EC2::VPCEndpoint', - Properties: { - RouteTableIds: [ - { - 'Fn::GetAtt': [ - 'TestRouteTableC34C2E1C', - 'RouteTableId', - ], - }, - ], - ServiceName: { - 'Fn::Join': [ - '', - [ - 'com.amazonaws.', - { Ref: 'AWS::Region' }, - '.s3express', - ], - ], - }, - VpcEndpointType: 'Gateway', - VpcId: { - 'Fn::GetAtt': [ - 'TestVpcE77CE678', - 'VpcId', - ], - }, - }, + routeTable.addRoute('Route', '0.0.0.0/0', { endpoint: dynamodb }); + // S3 endpoint should be in stack + Template.fromStack(stack).hasResourceProperties('AWS::EC2::VPCEndpoint', { + RouteTableIds: [ + { + 'Fn::GetAtt': [ + 'TestRouteTableC34C2E1C', + 'RouteTableId', + ], }, + ], + ServiceName: { + 'Fn::Join': [ + '', + [ + 'com.amazonaws.', + { Ref: 'AWS::Region' }, + '.s3express', + ], + ], + }, + VpcEndpointType: 'Gateway', + VpcId: { + 'Fn::GetAtt': [ + 'TestVpcE77CE678', + 'VpcId', + ], }, }); }); diff --git a/packages/@aws-cdk/aws-ec2-alpha/test/subnet-v2.test.ts b/packages/@aws-cdk/aws-ec2-alpha/test/subnet-v2.test.ts index bf1c3209dacce..3aa8492e4fdc2 100644 --- a/packages/@aws-cdk/aws-ec2-alpha/test/subnet-v2.test.ts +++ b/packages/@aws-cdk/aws-ec2-alpha/test/subnet-v2.test.ts @@ -5,6 +5,7 @@ import * as subnet from '../lib/subnet-v2'; import { NetworkAcl, SubnetType } from 'aws-cdk-lib/aws-ec2'; import { AddressFamily, AwsServiceName, Ipam, IpamPoolPublicIpSource } from '../lib/ipam'; import { createTestSubnet } from './util'; +import { RouteTable } from '../lib'; /** * Test suite for the SubnetV2 class. @@ -302,4 +303,33 @@ describe('Subnet V2 with custom IP and routing', () => { expect(Template.fromStack(stack).hasResource('AWS::EC2::SubnetNetworkAclAssociation', {})); }); + test('should associate a RouteTable with the subnet', () => { + const testVpc = new vpc.VpcV2(stack, 'TestVPC', { + primaryAddressBlock: vpc.IpAddresses.ipv4('10.1.0.0/16'), + }); + const subnetConfig = { + vpcV2: testVpc, + availabilityZone: 'us-east-1a', + cidrBlock: new subnet.IpCidr('10.1.0.0/24'), + subnetType: SubnetType.PUBLIC, + }; + const testsubnet = createTestSubnet(stack, subnetConfig); + + const routeTable = new RouteTable(stack, 'TestNewRouteTable', { + vpc: testVpc, + }); + + testsubnet.associateRouteTable(routeTable); + + expect(Template.fromStack(stack).hasResource('AWS::EC2::SubnetRouteTableAssociation', { + Properties: { + RouteTableId: { + 'Fn::GetAtt': [ + 'TestNewRouteTable240E1177', 'RouteTableId', + ], + }, + }, + })); + }); + });