Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using create_multiple_public_route_tables = true only creates an internet gateway route on one route table. #1087

Closed
1 task done
dancashTT opened this issue Jun 3, 2024 · 4 comments · Fixed by #1100
Closed
1 task done

Comments

@dancashTT
Copy link

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"
  },
]
@fedeostrit
Copy link

Good day, I have the same problem, a single route is created that is attached only to the first route-table, if you have "create_multiple_public_route_tables" activated, no more routes are generated for each of the Azs

@bryantbiggs Is there any PR designed to solve this problem?

@TroyMartens
Copy link

TroyMartens commented Jul 12, 2024

Would love to see this PR merged. Makes it hard to choose this module for HA architectures.

@antonbabenko
Copy link
Member

This issue has been resolved in version 5.11.0 🎉

Copy link

github-actions bot commented Sep 3, 2024

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
4 participants