terraform-aws-modules / terraform-aws-vpc

Terraform module to create AWS VPC resources 🇺🇦
https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws
Apache License 2.0
2.97k stars 4.42k forks source link

feat: Control database subnet route table pattern #1063

Closed gabrielhm1 closed 4 months ago

gabrielhm1 commented 5 months ago

Description

Support for multiple database subnet architectures.

Motivation and Context

Before this change, when create_database_internet_gateway_route was set to true, the database subnet had the following behavior:

However, the Egress-Only Internet Gateway only allows outbound traffic. Consequently, the database subnet might receive inbound IPv4 traffic and outbound IPv4 traffic, but only outbound traffic for IPv6.

After this change, there are four patterns for the database subnet:

  1. Public Pattern:

    • For IPv4 traffic: 0.0.0.0 -> Internet Gateway
    • For IPv6 traffic: ::/0 -> Internet Gateway
    create_database_subnet_route_table = true
    create_database_internet_gateway_route = true
    create_database_egress_only_internet_gateway_route = false
    create_database_nat_gateway_route = false
  2. Full NAT Pattern:

    • For IPv4 traffic: 0.0.0.0 -> NAT Gateway
    • For IPv6 traffic: 64:ff9b::/96 -> NAT Gateway
    create_database_subnet_route_table = true
    create_database_internet_gateway_route = false
    create_database_egress_only_internet_gateway_route = false
    create_database_nat_gateway_route = true
  3. IPv4 NAT + IPv6 Egress-Only:

    • For IPv4 traffic: 0.0.0.0 -> NAT Gateway
    • For IPv6 traffic: ::/0 -> Egress-Only Internet Gateway
    create_database_subnet_route_table = true
    create_database_internet_gateway_route = false
    create_database_egress_only_internet_gateway_route = true
    create_database_nat_gateway_route = true
  4. IPv6 Egress-Only Pattern:

    • For IPv4 traffic: 0.0.0.0/0 -> Not configured
    • For IPv6 traffic: ::/0 -> Egress-Only Internet Gateway
    create_database_subnet_route_table = true
    create_database_internet_gateway_route = false
    create_database_egress_only_internet_gateway_route = true
    create_database_nat_gateway_route = false

Breaking Changes

If create_database_internet_gateway_route = true, "aws_route" "database_ipv6_egress" resource will be destroyed and replaced by "aws_route" "database_internet_gateway_ipv6".

How Has This Been Tested?

The Terraform code was tested for all scenarios described in the motivation and context section.

github-actions[bot] commented 4 months ago

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

github-actions[bot] commented 4 months ago

This PR was automatically closed because of stale in 10 days

github-actions[bot] commented 3 months ago

I'm going to lock this pull request 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 related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.