Skip to content

(aws-ec2): AddRouteOptions does not include RouterType for Transit Gateway and other types #19057

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

Closed
lukevo247 opened this issue Feb 19, 2022 · 3 comments · Fixed by #20151
Closed
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2

Comments

@lukevo247
Copy link

lukevo247 commented Feb 19, 2022

General Issue

Users are unable to specify transit gateway as a routertype when specifying a route for vpc subnets. As well as a variety of other types available through the AWS console.

The Question

I want to be able to provision routes to my transit gateway. As it stands, not all of the router_type are available via CDK.

The console allows users to specify a variety of options not yet available in CDK: Transit Gateway, Virtual Private Gateway, Outposts Local Gateway, etc.

None of the existing options work, including aws_ec2.RouterType.GATEWAY which specifies an Internet Gateway.

Example:

for subnet in range(len(vpc.private_subnets)):
                (vpc.private_subnets[subnet]).add_route("StaticRoute",
                router_id=tgw_id,
                router_type=aws_ec2.RouterType.GATEWAY,
                destination_cidr_block="10.0.0.0/24"
                )

Is there a way around this to add a route to a transit gateway to my route table?
Link to documentation: https://docs.aws.amazon.com/cdk/api/v1/python/aws_cdk.aws_ec2/RouterType.html#aws_cdk.aws_ec2.RouterType

CDK CLI Version

1.140.0

Framework Version

1.140.0

Node.js Version

8.1.2

OS

macOS 12.2.1

Language

Python

Language Version

Python 3.9.10

Other information

This appears to be a missing feature/bug in all of the languages across CDK v1 and v2.

@lukevo247 lukevo247 added guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Feb 19, 2022
@peterwoodworth peterwoodworth added effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2 and removed guidance Question that needs advice or information. needs-triage This issue or PR still needs to be triaged. labels Feb 22, 2022
@peterwoodworth
Copy link
Contributor

We currently don't support this, however this should be a pretty simple fix. We accept contributions 🙂

In the meantime, you can use escape hatches to set the transitGatewayId property on the underlying CfnRoute created by addRoute.

@bearrito
Copy link

I'm not familiar with using the escape hatches. What would this look like for TGW?

@mergify mergify bot closed this as completed in #20151 May 18, 2022
mergify bot pushed a commit that referenced this issue May 18, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
Fixes #19057
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#aws-resource-ec2-route-properties

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@github-actions
Copy link
Contributor

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

wphilipw pushed a commit to wphilipw/aws-cdk that referenced this issue May 23, 2022
Fixes aws#19057
https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-ec2-route.html#aws-resource-ec2-route-properties

----

### All Submissions:

* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
effort/small Small work item – less than a day of effort feature-request A feature should be added or improved. good first issue Related to contributions. See CONTRIBUTING.md p2
Projects
None yet
5 participants