-
-
Notifications
You must be signed in to change notification settings - Fork 4.5k
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
fix: Do not replace NAT gateways when additional subnets are added #1055
fix: Do not replace NAT gateways when additional subnets are added #1055
Conversation
e8bfc7c
to
4dff716
Compare
4dff716
to
2ded1dd
Compare
tf-controller plan output: No changes. Your infrastructure matches the configuration.
Terraform has compared your real infrastructure against your configuration
and found no differences, so no changes are needed.
To apply this plan, please merge this pull request. |
@@ -1034,7 +1034,7 @@ resource "aws_route" "private_ipv6_egress" { | |||
|
|||
locals { | |||
nat_gateway_count = var.single_nat_gateway ? 1 : var.one_nat_gateway_per_az ? length(var.azs) : local.max_subnet_length | |||
nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : try(aws_eip.nat[*].id, []) | |||
nat_gateway_ips = var.reuse_nat_ips ? var.external_nat_ip_ids : aws_eip.nat[*].id |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why would this change make a difference?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because the try statement can't be evaluated while planning, so the nat gateways are all replaced, despite the fact that they are not changed
## [5.8.1](v5.8.0...v5.8.1) (2024-04-26) ### Bug Fixes * Do not replace NAT gateways when additional subnets are added ([#1055](#1055)) ([cf18c37](cf18c37))
This PR is included in version 5.8.1 🎉 |
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. |
Description
Adding new private subnets to an already deployed vpc module leads to the replacement of the nat gateways for all the subnets that already existing.
There is no reason to use the try function in that case.
Motivation and Context
Breaking Changes
none
How Has This Been Tested?
examples/*
to demonstrate and validate my change(s)examples/*
projectspre-commit run -a
on my pull requestBefore the change
After the change