Skip to content

Enabling database subnets with NAT gateway routes fails with one NAT gateway per AZ  #516

@Chili-Man

Description

@Chili-Man

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       = false

The 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-5b12fc096c11

The problem lies here:

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions