Skip to content

aws_instance: fix ipv6_addresses / ipv6_addresses_count refresh #43158

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

justinretzolk
Copy link
Member

@justinretzolk justinretzolk commented Jun 24, 2025

Rollback Plan

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

Changes to Security Controls

No changes

Description

Updates aws_instance so that ipv6_addresses are recomputed when ipv6_address_count is updated.

In order to achieve this, I needed to remove ForceNew from ipv6_addresses, but reimplemented the functionality via customdiff.ForceNewIf.

The TestAccEC2Instance_IPv6AddressesExplicit test may be overkill -- since the instance is recreated when ipv6_addresses is explicitly changed, ipv6_address_count should inherently be recomputed since it's a new instance. I introduced it anyways, to make sure that the customdiff.ForceNewIf did what I was expecting.

I also updated the name of the TestAccEC2Instance_IPv6AddressCountAndSingleAddressCausesError test function in order to make it more convenient to run with TESTS=TestAccEC2Instance_IPv6.

Relations

Closes #43009

Output from Acceptance Testing

$ make testacc TESTS=TestAccEC2Instance_IPv6 PKG=ec2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.24.4 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccEC2Instance_IPv6'  -timeout 360m -vet=off
2025/06/24 10:04:41 Creating Terraform AWS Provider (SDKv2-style)...
2025/06/24 10:04:42 Initializing Terraform AWS Provider (SDKv2-style)...
=== RUN   TestAccEC2Instance_IPv6_supportAddressCount
=== PAUSE TestAccEC2Instance_IPv6_supportAddressCount
=== RUN   TestAccEC2Instance_IPv6AddressCountAndSingleAddressCausesError
=== PAUSE TestAccEC2Instance_IPv6AddressCountAndSingleAddressCausesError
=== RUN   TestAccEC2Instance_IPv6_primaryEnable
=== PAUSE TestAccEC2Instance_IPv6_primaryEnable
=== RUN   TestAccEC2Instance_IPv6_primaryDisable
=== PAUSE TestAccEC2Instance_IPv6_primaryDisable
=== RUN   TestAccEC2Instance_IPv6_supportAddressCountWithIPv4
=== PAUSE TestAccEC2Instance_IPv6_supportAddressCountWithIPv4
=== RUN   TestAccEC2Instance_IPv6AddressCount
=== PAUSE TestAccEC2Instance_IPv6AddressCount
=== RUN   TestAccEC2Instance_IPv6AddressesExplicit
=== PAUSE TestAccEC2Instance_IPv6AddressesExplicit
=== CONT  TestAccEC2Instance_IPv6_supportAddressCount
=== CONT  TestAccEC2Instance_IPv6AddressesExplicit
=== CONT  TestAccEC2Instance_IPv6_primaryEnable
=== CONT  TestAccEC2Instance_IPv6_supportAddressCountWithIPv4
=== CONT  TestAccEC2Instance_IPv6_primaryDisable
=== CONT  TestAccEC2Instance_IPv6AddressCountAndSingleAddressCausesError
=== CONT  TestAccEC2Instance_IPv6AddressCount
--- PASS: TestAccEC2Instance_IPv6AddressCountAndSingleAddressCausesError (2.23s)
--- PASS: TestAccEC2Instance_IPv6_supportAddressCountWithIPv4 (111.06s)
--- PASS: TestAccEC2Instance_IPv6_supportAddressCount (111.10s)
--- PASS: TestAccEC2Instance_IPv6_primaryEnable (147.70s)
--- PASS: TestAccEC2Instance_IPv6AddressCount (177.61s)
--- PASS: TestAccEC2Instance_IPv6_primaryDisable (177.66s)
--- PASS: TestAccEC2Instance_IPv6AddressesExplicit (354.97s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	361.486s

@justinretzolk justinretzolk requested a review from a team as a code owner June 24, 2025 15:25
Copy link

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.

@github-actions github-actions bot added prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/ec2 Issues and PRs that pertain to the ec2 service. size/M Managed by automation to categorize the size of a PR. labels Jun 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/ec2 Issues and PRs that pertain to the ec2 service. size/M 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.

Ipv6 terraform apply fails while creating route53 record resource on first run
1 participant