Skip to content
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: fix aws_vpclattice_service_network_vpc_association forced replacement #32658

Conversation

nmoutschen
Copy link
Contributor

Description

aws_vpclattice_service_network_vpc_association supports specifying a service network ID or ARN, but the current implementation would force a resource replacement on updates if we pass an ARN.

This change uses a custom diff function for service_network_identifier for the aws_vpclattice_service_network_vpc_association that matches no matter if the user provides an ARN or resource ID.

Relations

Closes #31896

References

Output from Acceptance Testing

% make testacc TESTS=TestAccVPCLatticeServiceNetworkVPCAssociation PKG=vpclattice

==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/vpclattice/... -v -count 1 -parallel 20 -run='TestAccVPCLatticeServiceNetworkVPCAssociation'  -timeout 180m
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_basic
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_basic
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_arn
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_arn
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_disappears
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_disappears
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_full
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_full
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_tags
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_tags
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_basic
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_full
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_tags
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_arn
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_disappears
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_basic (69.12s)
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_disappears (98.19s)
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_arn (104.14s)
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_full (129.81s)
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_tags (147.95s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/vpclattice 151.402s

@github-actions
Copy link

Community Note

Voting for Prioritization

  • Please vote on this pull request by adding a 👍 reaction to the original post to help the community and maintainers prioritize this pull request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

For Submitters

  • Review the contribution guide relating to the type of change you are making to ensure all of the necessary steps have been taken.
  • For new resources and data sources, use skaff to generate scaffolding with comments detailing common expectations.
  • 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 tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/vpclattice Issues and PRs that pertain to the vpclattice service. size/S Managed by automation to categorize the size of a PR. needs-triage Waiting for first response or review from a maintainer. labels Jul 24, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @nmoutschen 👋

It looks like this is your first Pull Request submission to the Terraform AWS Provider! If you haven’t already done so please make sure you have checked out our CONTRIBUTOR guide and FAQ to make sure your contribution is adhering to best practice and has all the necessary elements in place for a successful approval.

Also take a look at our FAQ which details how we prioritize Pull Requests for inclusion.

Thanks again, and welcome to the community! 😃

@github-actions github-actions bot added size/M Managed by automation to categorize the size of a PR. and removed size/S Managed by automation to categorize the size of a PR. labels Jul 24, 2023
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. and removed needs-triage Waiting for first response or review from a maintainer. labels Jul 24, 2023
Copy link
Contributor

@ewbankkit ewbankkit left a comment

Choose a reason for hiding this comment

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

LGTM 🚀.

% make testacc TESTARGS='-run=TestAccVPCLatticeServiceNetworkVPCAssociation_' PKG=vpclattice ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/vpclattice/... -v -count 1 -parallel 2  -run=TestAccVPCLatticeServiceNetworkVPCAssociation_ -timeout 180m
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_basic
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_basic
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_arn
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_arn
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_disappears
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_disappears
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_full
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_full
=== RUN   TestAccVPCLatticeServiceNetworkVPCAssociation_tags
=== PAUSE TestAccVPCLatticeServiceNetworkVPCAssociation_tags
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_basic
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_full
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_full (79.22s)
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_disappears
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_basic (101.09s)
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_tags
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_disappears (74.56s)
=== CONT  TestAccVPCLatticeServiceNetworkVPCAssociation_arn
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_tags (124.50s)
--- PASS: TestAccVPCLatticeServiceNetworkVPCAssociation_arn (79.70s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/vpclattice	238.616s
% make testacc TESTARGS='-run=TestAccVPCLatticeServiceNetworkServiceAssociation_' PKG=vpclattice ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/vpclattice/... -v -count 1 -parallel 2  -run=TestAccVPCLatticeServiceNetworkServiceAssociation_ -timeout 180m
=== RUN   TestAccVPCLatticeServiceNetworkServiceAssociation_basic
=== PAUSE TestAccVPCLatticeServiceNetworkServiceAssociation_basic
=== RUN   TestAccVPCLatticeServiceNetworkServiceAssociation_arn
=== PAUSE TestAccVPCLatticeServiceNetworkServiceAssociation_arn
=== RUN   TestAccVPCLatticeServiceNetworkServiceAssociation_disappears
=== PAUSE TestAccVPCLatticeServiceNetworkServiceAssociation_disappears
=== RUN   TestAccVPCLatticeServiceNetworkServiceAssociation_tags
=== PAUSE TestAccVPCLatticeServiceNetworkServiceAssociation_tags
=== CONT  TestAccVPCLatticeServiceNetworkServiceAssociation_basic
=== CONT  TestAccVPCLatticeServiceNetworkServiceAssociation_disappears
--- PASS: TestAccVPCLatticeServiceNetworkServiceAssociation_disappears (32.80s)
=== CONT  TestAccVPCLatticeServiceNetworkServiceAssociation_tags
--- PASS: TestAccVPCLatticeServiceNetworkServiceAssociation_basic (35.26s)
=== CONT  TestAccVPCLatticeServiceNetworkServiceAssociation_arn
--- PASS: TestAccVPCLatticeServiceNetworkServiceAssociation_arn (33.26s)
--- PASS: TestAccVPCLatticeServiceNetworkServiceAssociation_tags (68.45s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/vpclattice	105.914s

@ewbankkit
Copy link
Contributor

@nmoutschen Thanks for the contribution 🎉 👏.
On closer examination, many of the other VPC Lattice resources exhibit the same behavior when passing an ARN in an _identifier attribute.
I fixed up aws_vpclattice_service_network_service_association additionally as part of this PR and will fix the others whilst merging other VPC Lattice PRs.

@ewbankkit ewbankkit merged commit 3004b33 into hashicorp:main Jul 26, 2023
34 checks passed
@github-actions github-actions bot added this to the v5.10.0 milestone Jul 26, 2023
@github-actions
Copy link

This functionality has been released in v5.10.0 of the Terraform AWS Provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

For further feature requests or bug reports with this functionality, please create a new GitHub issue following the template. Thank you!

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Addresses a defect in current functionality. service/vpclattice Issues and PRs that pertain to the vpclattice 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
3 participants