terraform-aws-modules / terraform-aws-transit-gateway

Terraform module to create AWS Transit Gateway resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/transit-gateway/aws
Apache License 2.0
144 stars 226 forks source link

Using IPv6 with `vpc_attachments[].vpc_route_table_ids` fails #101

Closed Jarodiv closed 1 year ago

Jarodiv commented 1 year ago

Description

The module generally supports the use of IPv6. But when adding routes to the tables provided via vpc_attachments[].vpc_route_table_ids, it always tries to assign the vpc_attachments[].tgw_destination_cidr to the IPv4 aws_route.destination_cidr_block argument. Correct would be using aws_route.destination_cidr_block for IPv4 and aws_route.destination_ipv6_cidr_block for IPv6.

Versions

Reproduction Code [Required]

Everything it needs is to configure IPv6 and provide VPC Route Tables:

module "my_vpc_ipv6" {
  source  = "terraform-aws-modules/vpc/aws"
  version = "~> 3.0"

  name = "my-vpc-ipv6"
  cidr = "10.1.0.0/16"

  azs             = ["${local.region}a", "${local.region}b"]
  private_subnets = ["10.1.1.0/24", "10.1.2.0/24"]
  public_subnets  = ["10.1.101.0/24", "10.1.102.0/24"]

  enable_nat_gateway = false

  enable_ipv6                     = true
  assign_ipv6_address_on_creation = true

  private_subnet_assign_ipv6_address_on_creation = false

  public_subnet_ipv6_prefixes  = [0, 1]
  private_subnet_ipv6_prefixes = [2, 3]
}

module "my_tgw_ipv6" {
  source  = "terraform-aws-modules/transit-gateway/aws"
  version = "~> 2.0"

  name = "my-tgw-ipv6"

  vpc_attachments = {
    vpc = {
      vpc_id     = module.my_vpc_ipv6.vpc_id
      subnet_ids = module.my_vpc_ipv6.private_subnets

      ipv6_support         = true
      tgw_destination_cidr = "::/0"
      vpc_route_table_ids  = module.my_vpc_ipv6.private_route_table_ids
    },
  }
}

Expected behavior

The code runs and IPv6 routes are being created.

Actual behavior

The code would fails because of issue https://github.com/terraform-aws-modules/terraform-aws-transit-gateway/issues/100, but else it would fail, trying to assign an IPv6 CIDR to the IPv4 aws_route.destination_cidr_block instead of using its IPv6 counterpart aws_route.destination_ipv6_cidr_block.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

Jarodiv commented 1 year ago

Cannot remove the label, so need to comment in order to prevent this issue from being closed.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

Jarodiv commented 1 year ago

"Keep alive" post

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 10 days

github-actions[bot] commented 1 year ago

This issue was automatically closed because of stale in 10 days

Jarodiv commented 1 year ago

Any way to re-ope this issue? The issue still exists and the PR fixing it is still not merged

github-actions[bot] commented 1 year ago

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.

antonbabenko commented 11 months ago

This issue has been resolved in version 2.12.1 :tada: