Skip to content

Allows secondary_private_ip_address_count to be updated in place#47477

Open
lorengordon wants to merge 1 commit intohashicorp:mainfrom
lorengordon:fix/private-natgw-secondary-ip-count
Open

Allows secondary_private_ip_address_count to be updated in place#47477
lorengordon wants to merge 1 commit intohashicorp:mainfrom
lorengordon:fix/private-natgw-secondary-ip-count

Conversation

@lorengordon
Copy link
Copy Markdown
Contributor

@lorengordon lorengordon commented Apr 15, 2026

Rollback Plan

If a change needs to be reverted, we will publish an updated version of the library.

Changes to Security Controls

Are there any changes to security controls (access controls, encryption, logging) in this pull request? If so, explain.

Description

Updates support for private AWS NAT Gateway to allow secondary_private_ip_address_count to be updated in place

Relations

Closes #47476

References

Output from Acceptance Testing

make testacc TESTS=TestAccVPCNATGateway_ PKG=ec2 ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
make: Running acceptance tests on branch: 🌿 fix/private-natgw-secondary-ip-count 🌿...
TF_ACC=1 go1.26.2 test ./internal/service/ec2/... -v -count 1 -parallel 3 -run='TestAccVPCNATGateway_'  -timeout 360m -vet=off
2026/04/17 10:42:47 Creating Terraform AWS Provider (SDKv2-style)...
2026/04/17 10:42:47 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccVPCNATGateway_Identity_basic
=== PAUSE TestAccVPCNATGateway_Identity_basic
=== RUN   TestAccVPCNATGateway_Identity_regionOverride
=== PAUSE TestAccVPCNATGateway_Identity_regionOverride
=== RUN   TestAccVPCNATGateway_Identity_ExistingResource_basic
=== PAUSE TestAccVPCNATGateway_Identity_ExistingResource_basic
=== RUN   TestAccVPCNATGateway_Identity_ExistingResource_noRefreshNoChange
=== PAUSE TestAccVPCNATGateway_Identity_ExistingResource_noRefreshNoChange
=== RUN   TestAccVPCNATGateway_List_basic
=== PAUSE TestAccVPCNATGateway_List_basic
=== RUN   TestAccVPCNATGateway_List_includeResource
=== PAUSE TestAccVPCNATGateway_List_includeResource
=== RUN   TestAccVPCNATGateway_List_regionOverride
=== PAUSE TestAccVPCNATGateway_List_regionOverride
=== RUN   TestAccVPCNATGateway_basic
=== PAUSE TestAccVPCNATGateway_basic
=== RUN   TestAccVPCNATGateway_disappears
=== PAUSE TestAccVPCNATGateway_disappears
=== RUN   TestAccVPCNATGateway_ConnectivityType_private
=== PAUSE TestAccVPCNATGateway_ConnectivityType_private
=== RUN   TestAccVPCNATGateway_privateIP
=== PAUSE TestAccVPCNATGateway_privateIP
=== RUN   TestAccVPCNATGateway_tags
=== PAUSE TestAccVPCNATGateway_tags
=== RUN   TestAccVPCNATGateway_secondaryAllocationIDs
=== PAUSE TestAccVPCNATGateway_secondaryAllocationIDs
=== RUN   TestAccVPCNATGateway_addSecondaryAllocationIDs
=== PAUSE TestAccVPCNATGateway_addSecondaryAllocationIDs
=== RUN   TestAccVPCNATGateway_secondaryPrivateIPAddressCount
=== PAUSE TestAccVPCNATGateway_secondaryPrivateIPAddressCount
=== RUN   TestAccVPCNATGateway_secondaryPrivateIPAddressCountToSpecific
=== PAUSE TestAccVPCNATGateway_secondaryPrivateIPAddressCountToSpecific
=== RUN   TestAccVPCNATGateway_secondaryPrivateIPAddressCount_updateInPlace
=== PAUSE TestAccVPCNATGateway_secondaryPrivateIPAddressCount_updateInPlace
=== RUN   TestAccVPCNATGateway_secondaryPrivateIPAddresses
=== PAUSE TestAccVPCNATGateway_secondaryPrivateIPAddresses
=== RUN   TestAccVPCNATGateway_SecondaryPrivateIPAddresses_private
=== PAUSE TestAccVPCNATGateway_SecondaryPrivateIPAddresses_private
=== RUN   TestAccVPCNATGateway_availabilityModeRegionalAuto
=== PAUSE TestAccVPCNATGateway_availabilityModeRegionalAuto
=== RUN   TestAccVPCNATGateway_availabilityModeRegionalManual_AddAndRemove
=== PAUSE TestAccVPCNATGateway_availabilityModeRegionalManual_AddAndRemove
=== RUN   TestAccVPCNATGateway_availabilityModeRegionalManual_ReplaceAndRemove
=== PAUSE TestAccVPCNATGateway_availabilityModeRegionalManual_ReplaceAndRemove
=== RUN   TestAccVPCNATGateway_availabilityModeRegionalManual_AZNameToAZID
=== PAUSE TestAccVPCNATGateway_availabilityModeRegionalManual_AZNameToAZID
=== RUN   TestAccVPCNATGateway_availabilityModeRegionalManual_AZIDToAZName
=== PAUSE TestAccVPCNATGateway_availabilityModeRegionalManual_AZIDToAZName
=== RUN   TestAccVPCNATGateway_availabilityModeRegionalSwitchMode
=== PAUSE TestAccVPCNATGateway_availabilityModeRegionalSwitchMode
=== CONT  TestAccVPCNATGateway_Identity_basic
=== CONT  TestAccVPCNATGateway_addSecondaryAllocationIDs
=== CONT  TestAccVPCNATGateway_availabilityModeRegionalAuto
--- PASS: TestAccVPCNATGateway_availabilityModeRegionalAuto (231.90s)
=== CONT  TestAccVPCNATGateway_availabilityModeRegionalManual_AZNameToAZID
--- PASS: TestAccVPCNATGateway_Identity_basic (237.58s)
=== CONT  TestAccVPCNATGateway_availabilityModeRegionalSwitchMode
--- PASS: TestAccVPCNATGateway_addSecondaryAllocationIDs (640.60s)
=== CONT  TestAccVPCNATGateway_availabilityModeRegionalManual_AZIDToAZName
--- PASS: TestAccVPCNATGateway_availabilityModeRegionalSwitchMode (586.87s)
=== CONT  TestAccVPCNATGateway_basic
--- PASS: TestAccVPCNATGateway_basic (216.86s)
=== CONT  TestAccVPCNATGateway_secondaryAllocationIDs
--- PASS: TestAccVPCNATGateway_availabilityModeRegionalManual_AZNameToAZID (1116.32s)
=== CONT  TestAccVPCNATGateway_tags
--- PASS: TestAccVPCNATGateway_tags (273.59s)
=== CONT  TestAccVPCNATGateway_privateIP
--- PASS: TestAccVPCNATGateway_secondaryAllocationIDs (695.90s)
=== CONT  TestAccVPCNATGateway_ConnectivityType_private
--- PASS: TestAccVPCNATGateway_availabilityModeRegionalManual_AZIDToAZName (1135.33s)
=== CONT  TestAccVPCNATGateway_disappears
--- PASS: TestAccVPCNATGateway_privateIP (218.80s)
=== CONT  TestAccVPCNATGateway_availabilityModeRegionalManual_ReplaceAndRemove
--- PASS: TestAccVPCNATGateway_ConnectivityType_private (197.84s)
=== CONT  TestAccVPCNATGateway_availabilityModeRegionalManual_AddAndRemove
--- PASS: TestAccVPCNATGateway_disappears (273.12s)
=== CONT  TestAccVPCNATGateway_List_basic
--- PASS: TestAccVPCNATGateway_List_basic (232.93s)
=== CONT  TestAccVPCNATGateway_List_regionOverride
--- PASS: TestAccVPCNATGateway_List_regionOverride (218.14s)
=== CONT  TestAccVPCNATGateway_List_includeResource
--- PASS: TestAccVPCNATGateway_availabilityModeRegionalManual_AddAndRemove (674.57s)
=== CONT  TestAccVPCNATGateway_secondaryPrivateIPAddressCount_updateInPlace
--- PASS: TestAccVPCNATGateway_List_includeResource (182.95s)
=== CONT  TestAccVPCNATGateway_SecondaryPrivateIPAddresses_private
--- PASS: TestAccVPCNATGateway_availabilityModeRegionalManual_ReplaceAndRemove (1101.38s)
=== CONT  TestAccVPCNATGateway_secondaryPrivateIPAddresses
--- PASS: TestAccVPCNATGateway_secondaryPrivateIPAddressCount_updateInPlace (343.51s)
=== CONT  TestAccVPCNATGateway_Identity_ExistingResource_basic
--- PASS: TestAccVPCNATGateway_Identity_ExistingResource_basic (288.23s)
=== CONT  TestAccVPCNATGateway_Identity_ExistingResource_noRefreshNoChange
--- PASS: TestAccVPCNATGateway_SecondaryPrivateIPAddresses_private (610.15s)
=== CONT  TestAccVPCNATGateway_Identity_regionOverride
--- PASS: TestAccVPCNATGateway_Identity_ExistingResource_noRefreshNoChange (257.99s)
=== CONT  TestAccVPCNATGateway_secondaryPrivateIPAddressCountToSpecific
--- PASS: TestAccVPCNATGateway_Identity_regionOverride (257.70s)
=== CONT  TestAccVPCNATGateway_secondaryPrivateIPAddressCount
--- PASS: TestAccVPCNATGateway_secondaryPrivateIPAddresses (659.82s)
--- PASS: TestAccVPCNATGateway_secondaryPrivateIPAddressCount (215.30s)
--- PASS: TestAccVPCNATGateway_secondaryPrivateIPAddressCountToSpecific (594.00s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ec2        4093.839s
...

@lorengordon lorengordon requested a review from a team as a code owner April 15, 2026 20:57
@github-actions
Copy link
Copy Markdown
Contributor

Community Guidelines

This comment is added to every new Pull Request to provide quick reference to how the Terraform AWS Provider is maintained. Please review the information below, and thank you for contributing to the community that keeps the provider thriving! 🚀

Voting for Prioritization

  • Please vote on this Pull Request by adding a 👍 reaction to the original post to help the community and maintainers prioritize it.
  • Please see our prioritization guide for additional information on how the maintainers handle prioritization.
  • Please do not leave +1 or other comments that do not add relevant new information or questions; they generate extra noise for others following the Pull Request and do not help prioritize the request.

Pull Request Authors

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • Whether or not the branch has been rebased will not impact prioritization, but doing so is always a welcome surprise.

@dosubot dosubot Bot added the enhancement Requests to existing resources that expand the functionality or scope. label Apr 15, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Apr 15, 2026

✅ Thank you for correcting the previously detected issues! The maintainers appreciate your efforts to make the review process as smooth as possible.

@github-actions github-actions Bot added needs-triage Waiting for first response or review from a maintainer. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/vpc Issues and PRs that pertain to the vpc service. size/M Managed by automation to categorize the size of a PR. labels Apr 15, 2026
@lorengordon lorengordon force-pushed the fix/private-natgw-secondary-ip-count branch from 3b2e6ef to 2ce155a Compare April 16, 2026 00:55
@github-actions github-actions Bot added size/L Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels Apr 16, 2026
@lorengordon lorengordon force-pushed the fix/private-natgw-secondary-ip-count branch 3 times, most recently from 0a53c5f to 380168e Compare April 16, 2026 01:39
@lorengordon
Copy link
Copy Markdown
Contributor Author

Test failures seem unrelated to the changeset. Can someone advise if I need to address them?

@lorengordon lorengordon force-pushed the fix/private-natgw-secondary-ip-count branch from 380168e to 4bdfa63 Compare April 16, 2026 13:28
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. labels Apr 16, 2026
@lorengordon lorengordon marked this pull request as draft April 16, 2026 20:51
@lorengordon
Copy link
Copy Markdown
Contributor Author

Finding some race conditions when increasing the secondary count. Moving PR to draft while I sort it out.

@lorengordon lorengordon force-pushed the fix/private-natgw-secondary-ip-count branch from 4bdfa63 to 786972e Compare April 17, 2026 00:11
@lorengordon
Copy link
Copy Markdown
Contributor Author

lorengordon commented Apr 17, 2026

Ok, I think I got it. After way too much troubleshooting, ultimately turned out to be an eventual consistency issue when confirming that the secondary IP addresses had been assigned successfully. Updated the waiter to use ContinuousTargetOccurence and now it is behaving consistently.

@lorengordon lorengordon marked this pull request as ready for review April 17, 2026 00:42
@dosubot dosubot Bot added the enhancement Requests to existing resources that expand the functionality or scope. label Apr 17, 2026
@lorengordon lorengordon force-pushed the fix/private-natgw-secondary-ip-count branch 5 times, most recently from 423ad73 to 49ee8c0 Compare April 22, 2026 19:54
@lorengordon lorengordon force-pushed the fix/private-natgw-secondary-ip-count branch from 49ee8c0 to b92eb3f Compare April 27, 2026 15:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Addresses a defect in current functionality. enhancement Requests to existing resources that expand the functionality or scope. service/vpc Issues and PRs that pertain to the vpc service. size/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Changing secondary_private_ip_address_count on Private NAT Gateway force-replaces the resource

2 participants