Vpc Multiple Public Route Tables
One Public Route Table or One Per AZ? It Actually Matters
Most VPC examples share a single public route table across all AZs — fine for identical routing, wrong the moment one AZ needs different rules. This example flips the switch to per-AZ public route tables.
The configuration
module "vpc_app_example" {
source = "../../modules/vpc-app"
aws_region = var.aws_region
cidr_block = "10.0.0.0/16"
num_nat_gateways = 3
one_route_table_public_subnets = false
}
The single flag one_route_table_public_subnets = false changes the topology: instead of one public route table associated with every public subnet, each AZ gets its own.
When you actually need this
- Per-AZ egress control — different egress IPs, NAT appliances, or inspection hops per zone
- Isolating blast radius — a bad route change in AZ-a shouldn’t blackhole AZ-b’s public tier
- Asymmetric peering/TGW attachments — some zones transit to on-prem, others don’t
And when you don’t: a shared public table is simpler, and since public subnets typically all route 0.0.0.0/0 -> igw, per-AZ tables mostly duplicate identical rules.
Takeaway
Small flags like this are where module design earns its keep — the alternative is forking the routing logic. The module already gives per-AZ tables on the private side (NAT fate isolation); this flag extends the same principle to the public tier.
Verified: reconstructed example passes terraform validate against the real vpc-app module.