Aws-cdk: Unused route table created when creating a subnet

Created on 9 Aug 2019  路  3Comments  路  Source: aws/aws-cdk

  • I'm submitting a ...

    • [x] :beetle: bug report
    • [ ] :rocket: feature request
    • [ ] :books: construct library gap
    • [ ] :phone: security issue or vulnerability => Please see policy
    • [ ] :question: support request => Please see note at the top of this template.
  • What is the current behavior?
    When i create a Subnet, and change the RouteTableAssociation to an existing route table, an unused route table is created along with the subnet.

  • What is the expected behavior (or behavior of feature suggested)?
    I would like to be able to remove this route table or that cdk is smart enough to not create it

  • Please tell us about your environment:

    • CDK CLI Version: 1.3.0
    • Module Version: 1.3.0
    • OS: [OSX Mojave]
    • Language: [Java]
  • Other information (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. associated pull-request, stackoverflow, gitter, etc)

Subnet Subnet = new Subnet(this, "Subnet", SubnetProps.builder()
        .withVpcId(vpc.getVpcId())
        .withAvailabilityZone("eu-west-1b")
        .withCidrBlock(String.format("10.%d.43.128/25", environmentId))
        .build());

CfnSubnetRouteTableAssociation routeTableAssociation = (CfnSubnetRouteTableAssociation) subnet.getNode().tryFindChild("RouteTableAssociation");
routeTableAssociation.setRouteTableId(Fn.importValue(String.format("%s-nat-nat000", environment)));

CfnRouteTable cfnRouteTable = (CfnRouteTable) subnet.getNode().tryFindChild("RouteTable");
@aws-cdaws-ec2 efformedium feature-request p2

Most helpful comment

4308 RouteTable input would be appreciated.

Not only in SubnetProps but also in subnetConfiguration so it can be used directly in the VPC construct.

All 3 comments

I'm not sure this counts as a bug.

Unfortunately, the Subnet construct right now is heavily tied to the Vpc construct, and supports exactly the features it needs.

This sounds like a feature request for an optional RouteTable input parameter to Subnet.

4308 RouteTable input would be appreciated.

Not only in SubnetProps but also in subnetConfiguration so it can be used directly in the VPC construct.

Was this page helpful?
0 / 5 - 0 ratings