Skip to content

Comments

Support regional NAT gateway#232

Open
StephenKing wants to merge 1 commit intocloudposse:mainfrom
StephenKing:regional-nat
Open

Support regional NAT gateway#232
StephenKing wants to merge 1 commit intocloudposse:mainfrom
StephenKing:regional-nat

Conversation

@StephenKing
Copy link

what

Implement support for AWS regional NAT gateways (availability_mode = "regional").

I'm a bit unhappy with the size of the change, but apparently there was before no possibility to have only one private route table for multiple subnets. This, however, has the disadvantage that any updates (esp. when done for failover architectures) require updates to multiple routing tables.

why

  • no need to maintain separate routing tables per AZ
  • no need for public subnets
  • automatic scaling & management of EIPs

references

Terraform provider docs for aws_nat_gatewas

closes #228

When using regional NAT gateway, there is no
need for maintaining separate routing tables.

Default stays at 'zonal' availability mode,
which can be changed to 'regional'.

Fixes: cloudposse#228
@StephenKing StephenKing requested review from a team as code owners February 16, 2026 23:14
@mergify mergify bot added the triage Needs triage label Feb 16, 2026
# calculate the global subnet index in the flattened aws_subnet.public list
nat_gateway_public_subnet_indices = local.nat_gateway_useful ? flatten([
# Only used for zonal NAT gateways; regional NAT gateways don't need subnet placement
nat_gateway_public_subnet_indices = local.nat_gateway_useful && var.nat_gateway_availability_mode == "zonal" ? flatten([

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@StephenKing, could I ask you to shorten repeatable expressions like this to improve code readability?
E.g., local.nat_gateway_useful && var.nat_gateway_availability_mode == "zonal" -> local.zonal_nat_gateway_useful

@gberenice
Copy link

/terratest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

triage Needs triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support NAT Gateway Regional Mode

2 participants