Add support to create a custom route in a subnet for TGW #116
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Reasoning
TLDR The company where I work right now have 2 TGWs in the VPC. Each TGW is used for the different traffic.
It means I have to add a route for both TGWs to some specific subnets. Unfortunately I didn't find any way how to achieve it in the current state of the module. I noticed that one can use variables transit_gateway_id and transit_gateway_routes but this works only for one TGW. Additionally It is worth to mention that creation of VPC and TGWs is out of my control.
Implementation notes
Adding a new variable custom_route_to_tgw which is map of objects.
The map key is used to identify required subnets.
Each object contains route configuration.
Right now I'm creating a new route in the private and public subnets.
Not sure if this can be useful also for the transit_gateway and / or core_network subnets.
It is fair to mention that there is one limitation of this variable - one cannot create more routes per a subnet.
Not sure how to achieve it without too much changes.