Using `create_multiple_public_route_tables = true` only creates an internet gateway route on one route table.
dancashTT opened this issue · 4 comments
dancashTT commented
Description
When using the create_multiple_public_route_tables
option, it creates separate route tables as needed, but only the first one has a route to the internet gateway on 0.0.0.0/0.
- ✋ I have searched the open/closed issues and my issue is not listed.
Versions
-
Module version [Required]:
5.8.1
-
Terraform version:
Terraform v1.8.4
on windows_386
- Provider version(s):
hashicorp/aws v5.42.0
Reproduction Code [Required]
provider "aws" {
region = "us-west-1"
}
data "aws_availability_zones" "available" {}
module "vpc" {
source = "terraform-aws-modules/vpc/aws"
name = "vpctest"
cidr = "10.0.0.0/16"
azs = ["us-west-1a", "us-west-1c"]
private_subnets = ["10.0.16.0/20", "10.0.32.0/20"]
public_subnets = ["10.0.64.0/20", "10.0.80.0/20"]
database_subnets = ["10.0.112.0/20", "10.0.128.0/20"]
intra_subnets = ["10.0.0.0/24", "10.0.1.0/24"]
create_database_subnet_route_table = true
create_multiple_intra_route_tables = true
create_multiple_public_route_tables = true
enable_nat_gateway = true
single_nat_gateway = false
one_nat_gateway_per_az = true
create_igw = true
tags = {
Terraform = "true"
Environment = "poc"
}
}
data "aws_route_table" "public" {
count = length(module.vpc.public_subnets)
subnet_id = module.vpc.public_subnets[count.index]
}
output "public_routes" {
value = data.aws_route_table.public
}
Steps to reproduce the behavior:
terraform init
terraform apply
Expected behavior
I would expect the routes output to show a route for 0.0.0.0/0 to the IGW.
Actual behavior
Only 1 route table has the 0.0.0.0/0 route to the IGW
Terminal Output Screenshot(s)
public_routes = [
{
"arn" = "arn:aws:ec2:us-west-1:123456789012:route-table/rtb-02ddf93e5022dfa74"
"associations" = tolist([
{
"gateway_id" = ""
"main" = false
"route_table_association_id" = "rtbassoc-04dbbd3aa1ace4a29"
"route_table_id" = "rtb-02ddf93e5022dfa74"
"subnet_id" = "subnet-0ec0bbe2b9a39f30e"
},
])
"filter" = toset(null) /* of object */
"gateway_id" = tostring(null)
"id" = "rtb-02ddf93e5022dfa74"
"owner_id" = "123456789012"
"route_table_id" = "rtb-02ddf93e5022dfa74"
"routes" = tolist([
{
"carrier_gateway_id" = ""
"cidr_block" = "0.0.0.0/0"
"core_network_arn" = ""
"destination_prefix_list_id" = ""
"egress_only_gateway_id" = ""
"gateway_id" = "igw-0a6db78b89f50fb4a"
"instance_id" = ""
"ipv6_cidr_block" = ""
"local_gateway_id" = ""
"nat_gateway_id" = ""
"network_interface_id" = ""
"transit_gateway_id" = ""
"vpc_endpoint_id" = ""
"vpc_peering_connection_id" = ""
},
])
"subnet_id" = "subnet-0ec0bbe2b9a39f30e"
"tags" = tomap({
"Environment" = "poc"
"Name" = "cashvpc-public-us-west-1a"
"Terraform" = "true"
})
"timeouts" = null /* object */
"vpc_id" = "vpc-029910e17bdb25c18"
},
{
"arn" = "arn:aws:ec2:us-west-1:123456789012:route-table/rtb-0e4d30ed4c5657754"
"associations" = tolist([
{
"gateway_id" = ""
"main" = false
"route_table_association_id" = "rtbassoc-0eb33bfc893c518c6"
"route_table_id" = "rtb-0e4d30ed4c5657754"
"subnet_id" = "subnet-06b85da110feb7b6c"
},
])
"filter" = toset(null) /* of object */
"gateway_id" = tostring(null)
"id" = "rtb-0e4d30ed4c5657754"
"owner_id" = "123456789012"
"route_table_id" = "rtb-0e4d30ed4c5657754"
"routes" = tolist([])
"subnet_id" = "subnet-06b85da110feb7b6c"
"tags" = tomap({
"Environment" = "poc"
"Name" = "cashvpc-public-us-west-1c"
"Terraform" = "true"
})
"timeouts" = null /* object */
"vpc_id" = "vpc-029910e17bdb25c18"
},
]