pivotal / paving

Terraform templates for paving infrastructure to deploy the Pivotal Platform.
Apache License 2.0
48 stars 49 forks source link

AWS - NAT Gateways & Route Tables - Only one NAT Gateway being used for all AZ routes #71

Open JakeBogie opened 3 years ago

JakeBogie commented 3 years ago

Describe the bug NAT Gateways and Route Tables are created for the Availability Zones in AWS that Paving creates. If we create 3 Availability Zones we should get a route table and a NAT Gateway per AZ. When the route tables are configured all of the route tables (route-az0, route-az1, and route-az2) all use one NAT Gateway...and from my observation it's the first NAT Gateway created.

To Reproduce Run Paving in AWS, view all of the route tables and notate what NAT Gateway is being used in the route tables.

Expected behavior Each AZ gets a route table with the associated NAT Gateway defined for that AZ set as the default route for all 0.0.0.0/0 traffic.

Environment (please complete the following information): AWS paving v1.0.0

anEXPer commented 3 years ago

This is coming to our attention in part because AWS gives a notification that the configuration is wrong; would you mind including the text of that notification?

We don't have dedicated maintainers on this, so it may take us a bit to allocate work to it, but we probably will in the next two or three months. In the meantime, we'd definitely take a PR. Initial investigation suggests we don't need to worry about how the NAT gateway configuration would impact, for instance, the stable config, as it ends up just being a default for everything that gets put on the subnet. So, hopefully, this can be done as a pretty small change.

JakeBogie commented 3 years ago

This is coming to our attention in part because AWS gives a notification that the configuration is wrong; would you mind including the text of that notification?

Screen Shot 2021-01-26 at 13 01 32
sbogar-shs commented 3 years ago

I just noticed this myself, i think the fix is to change line 10 of the route-tables tf to nat_gateway_id = element(aws_nat_gateway.nat[*].id, count.index)

anEXPer commented 3 years ago

Lovely, we'd take a PR to this effect.