-
-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Closed
Description
When provisioning a VPC with the following options (in us-east-1 for example):
database_subnets = [
"10.50.160.0/22",
"10.50.164.0/22",
"10.50.168.0/22",
"10.50.172.0/22",
"10.50.176.0/22",
]
create_database_subnet_route_table = true
create_database_nat_gateway_route = true
create_database_subnet_group = false
enable_nat_gateway = true
one_nat_gateway_per_az = true
single_nat_gateway = falseThe following error occurs:
Error: Error creating route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.
status code: 400, request id: 6739c57a-097a-433d-a032-28fe6835033f
Error: Error creating route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.
status code: 400, request id: c4ab4221-dcc8-4eb0-b976-e5f15f6c7f47
Error: Error creating route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.
status code: 400, request id: 99a91d24-cb7b-4b4c-90db-e68e8faf1625
Error: Error creating route: RouteAlreadyExists: The route identified by 0.0.0.0/0 already exists.
status code: 400, request id: ad82436e-223e-4f90-91e9-5b12fc096c11The problem lies here:
- The database route table: https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/main.tf#L231-L232
- The database route rule for adding the nat gateway: https://github.com/terraform-aws-modules/terraform-aws-vpc/blob/master/main.tf#L257-L260
Only one database route table for all of the database subnets is created, but when enabling the create_database_nat_gateway_route and one_nat_gateway_per_az option, the database route rule resource expects there to be more then 1 database route table. However, what ends up happening is that it tries to modify that single database route table the same number of times there are nat gateways which causes the above RouteAlreadyExists error.
The solution would be to create multiple database route tables when both create_database_nat_gateway_route and one_nat_gateway_per_az are enabled, then it should work as expected.
Metadata
Metadata
Assignees
Labels
No labels