Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PublicRoute does not depend on gateway attachment #1140

Closed
clareliguori opened this issue Nov 10, 2018 · 0 comments
Closed

PublicRoute does not depend on gateway attachment #1140

clareliguori opened this issue Nov 10, 2018 · 0 comments
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud

Comments

@clareliguori
Copy link
Member

clareliguori commented Nov 10, 2018

Got the following error when deploying ec2.VpcNetwork: route table rtb-xxxx and network gateway igw-yyyy belong to different networks. This appears to be a race condition when the gateway attachment has not yet completed by the time the public route is created. The PublicRoute needs to depend on the gateway attachment:
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-attribute-dependson.html#gatewayattachment

Example synthesized route:

  VPCPublicSubnet2DefaultRouteB7481BBA:
    Type: 'AWS::EC2::Route'
    Properties:
      RouteTableId:
        Ref: VPCPublicSubnet2RouteTable6F1A15F1
      DestinationCidrBlock: 0.0.0.0/0
      GatewayId:
        Ref: VPCIGWB7E252D3

Route element needs a "DependsOn" for the gateway attachment

@debora-ito debora-ito added the @aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud label Nov 12, 2018
rix0rrr pushed a commit that referenced this issue Nov 13, 2018
…1142)

Currently there is a race condition when creating the
public subnet routes for the ec2.VpcNetwork construct. CloudFormation
can attempt to create the public subnet routes to the IGW before the IGW
is attached to the VPC. This change adds a dependency to the public
routes on the IGW attachment.

Fixes #1140. 

BREAKING CHANGE: Method signature of
VpcPublicSubnet.addDefaultIGWRouteEntry changed in order to add a
dependency on gateway attachment completing before creating the public
route to the gateway. Instead of passing a gateway ID string, pass in a
cloudformation.InternetGatewayResource object and a
cloudformation.VPCGatewayAttachmentResource object.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
@aws-cdk/aws-ec2 Related to Amazon Elastic Compute Cloud
Projects
None yet
Development

No branches or pull requests

2 participants