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

resource/aws_networkmanager_vpc_attachment: Allow deleting when not attached #34547

Merged
merged 10 commits into from
Nov 29, 2023

Conversation

gdavison
Copy link
Contributor

Description

When waiting for acceptance, the resource aws_networkmanager_vpc_attachment previously incorrectly returned an error stating that it could not be deleted.

This PR now rejects the VPC attachment and deletes it.

Previously, the Delete operation of the resource aws_networkmanager_attachment_accepter was a no-op, leaving any attachments in place.

For VPC attachments, deleting a corresponding aws_networkmanager_attachment_accepter now removes the attachment.

Previously, modifying the fields of the options parameter of aws_networkmanager_vpc_attachment would cause a run-time error.

Modifying these fields now causes re-creation of the aws_networkmanager_vpc_attachment.

Relations

Closes #34501
Relates #34502

References

Output from Acceptance Testing

% make testacc PKG=networkmanager TESTS=TestAccNetworkManagerVPCAttachment_

--- PASS: TestAccNetworkManagerVPCAttachment_basic (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_basic/acceptance_required (1345.47s)
    --- PASS: TestAccNetworkManagerVPCAttachment_basic/acceptance_not_required (2317.13s)
--- PASS: TestAccNetworkManagerVPCAttachment_disappears (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_disappears/acceptance_required (1321.43s)
    --- PASS: TestAccNetworkManagerVPCAttachment_disappears/acceptance_not_required (2389.43s)
--- PASS: TestAccNetworkManagerVPCAttachment_Attached_basic (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_required (2129.34s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_not_required (2449.04s)
--- PASS: TestAccNetworkManagerVPCAttachment_Attached_disappears (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_not_required (2479.80s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_required (2489.28s)
--- PASS: TestAccNetworkManagerVPCAttachment_Attached_disappearsAccepter (2501.96s)
--- PASS: TestAccNetworkManagerVPCAttachment_tags (2944.74s)
--- PASS: TestAccNetworkManagerVPCAttachment_update (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_update/acceptance_required (1825.50s)
    --- PASS: TestAccNetworkManagerVPCAttachment_update/acceptance_not_required (3688.78s)

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 size/XL Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/networkmanager Issues and PRs that pertain to the networkmanager service. labels Nov 23, 2023
@terraform-aws-provider terraform-aws-provider bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Nov 23, 2023
Copy link

Thank you for your contribution! 🚀

A new usage of AWS SDK for Go V1 was detected. Please prefer AWS SDK for Go V2 for all net-new services. If this is an enhancement or bug fix to an existing AWS SDK Go V1 based resource, this comment can be safely ignored.

For additional information refer to the AWS SDK for Go Versions page in the contributor guide.

@ewbankkit
Copy link
Contributor

ewbankkit commented Nov 28, 2023

% ACCTEST_TIMEOUT=720m make testacc TESTARGS='-run=TestAccNetworkManagerVPCAttachment_' PKG=networkmanager ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/networkmanager/... -v -count 1 -parallel 2  -run=TestAccNetworkManagerVPCAttachment_ -timeout 720m
=== RUN   TestAccNetworkManagerVPCAttachment_basic
=== PAUSE TestAccNetworkManagerVPCAttachment_basic
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_basic
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_basic
=== RUN   TestAccNetworkManagerVPCAttachment_disappears
=== PAUSE TestAccNetworkManagerVPCAttachment_disappears
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_disappears
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_disappears
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_disappearsAccepter
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_disappearsAccepter
=== RUN   TestAccNetworkManagerVPCAttachment_tags
=== PAUSE TestAccNetworkManagerVPCAttachment_tags
=== RUN   TestAccNetworkManagerVPCAttachment_update
=== PAUSE TestAccNetworkManagerVPCAttachment_update
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_update
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_update
=== CONT  TestAccNetworkManagerVPCAttachment_basic
=== RUN   TestAccNetworkManagerVPCAttachment_basic/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_update
=== PAUSE TestAccNetworkManagerVPCAttachment_basic/acceptance_required
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_not_required
=== RUN   TestAccNetworkManagerVPCAttachment_basic/acceptance_not_required
=== PAUSE TestAccNetworkManagerVPCAttachment_basic/acceptance_not_required
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_not_required
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_update
=== RUN   TestAccNetworkManagerVPCAttachment_update/acceptance_required
=== PAUSE TestAccNetworkManagerVPCAttachment_update/acceptance_required
=== RUN   TestAccNetworkManagerVPCAttachment_update/acceptance_not_required
=== PAUSE TestAccNetworkManagerVPCAttachment_update/acceptance_not_required
=== CONT  TestAccNetworkManagerVPCAttachment_tags
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_disappearsAccepter
--- PASS: TestAccNetworkManagerVPCAttachment_tags (977.58s)
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_disappears
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_not_required
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_not_required
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_required
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_disappears
=== RUN   TestAccNetworkManagerVPCAttachment_disappears/acceptance_required
=== PAUSE TestAccNetworkManagerVPCAttachment_disappears/acceptance_required
=== RUN   TestAccNetworkManagerVPCAttachment_disappears/acceptance_not_required
=== PAUSE TestAccNetworkManagerVPCAttachment_disappears/acceptance_not_required
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_basic
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_not_required
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_not_required
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_required
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_basic/acceptance_required
--- PASS: TestAccNetworkManagerVPCAttachment_Attached_disappearsAccepter (1001.23s)
=== CONT  TestAccNetworkManagerVPCAttachment_basic/acceptance_not_required
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_not_required
--- PASS: TestAccNetworkManagerVPCAttachment_basic (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_basic/acceptance_required (557.94s)
    --- PASS: TestAccNetworkManagerVPCAttachment_basic/acceptance_not_required (946.77s)
=== CONT  TestAccNetworkManagerVPCAttachment_update/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_update/acceptance_not_required
=== NAME  TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
    vpc_attachment_test.go:474: Step 2/5 error: Check failed: Check 2/5 error: Attachment not recreated: v1.CreatedAt="2023-11-28 16:14:07 +0000 UTC", v2.CreatedAt="2023-11-28 16:14:07 +0000 UTC"
--- FAIL: TestAccNetworkManagerVPCAttachment_Attached_update (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_not_required (1417.29s)
    --- FAIL: TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required (1192.91s)
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_not_required
--- PASS: TestAccNetworkManagerVPCAttachment_update (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_update/acceptance_required (604.55s)
    --- PASS: TestAccNetworkManagerVPCAttachment_update/acceptance_not_required (1331.29s)
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_disappears/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_disappears/acceptance_not_required
--- PASS: TestAccNetworkManagerVPCAttachment_Attached_disappears (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_not_required (930.57s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_disappears/acceptance_required (949.82s)
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_not_required
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_required
--- PASS: TestAccNetworkManagerVPCAttachment_disappears (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_disappears/acceptance_required (566.03s)
    --- PASS: TestAccNetworkManagerVPCAttachment_disappears/acceptance_not_required (1037.53s)
--- PASS: TestAccNetworkManagerVPCAttachment_Attached_basic (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_not_required (1020.32s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_basic/acceptance_required (1021.78s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/networkmanager	7290.332s
FAIL
make: *** [testacc] Error 1
% ACCTEST_TIMEOUT=720m make testacc TESTARGS='-run=TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required' PKG=networkmanager
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/networkmanager/... -v -count 1 -parallel 20  -run=TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required -timeout 720m
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_update
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_update
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_update
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
    vpc_attachment_test.go:474: Step 2/5 error: Check failed: Check 2/5 error: Attachment not recreated: v1.CreatedAt="2023-11-28 17:55:41 +0000 UTC", v2.CreatedAt="2023-11-28 17:55:41 +0000 UTC"
--- FAIL: TestAccNetworkManagerVPCAttachment_Attached_update (0.00s)
    --- FAIL: TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required (1113.09s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/networkmanager	1125.369s
FAIL
make: *** [testacc] Error 1

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 🚀.

% ACCTEST_TIMEOUT=720m make testacc TESTARGS='-run=TestAccNetworkManagerVPCAttachment_Attached_update' PKG=networkmanager
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/networkmanager/... -v -count 1 -parallel 20  -run=TestAccNetworkManagerVPCAttachment_Attached_update -timeout 720m
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_update
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_update
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_update
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
=== RUN   TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_not_required
=== PAUSE TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_not_required
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required
=== CONT  TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_not_required
--- PASS: TestAccNetworkManagerVPCAttachment_Attached_update (0.00s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_not_required (1431.89s)
    --- PASS: TestAccNetworkManagerVPCAttachment_Attached_update/acceptance_required (1463.39s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/networkmanager	1469.100s

@gdavison gdavison merged commit a2d3708 into main Nov 29, 2023
44 checks passed
@gdavison gdavison deleted the b-delete-unattached-netmgr-vpc-attachment branch November 29, 2023 20:10
@github-actions github-actions bot added this to the v5.29.0 milestone Nov 29, 2023
Copy link

github-actions bot commented Dec 1, 2023

This functionality has been released in v5.29.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!

Copy link

github-actions bot commented Jan 1, 2024

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 Jan 1, 2024
@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Feb 10, 2024
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. documentation Introduces or discusses updates to documentation. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/networkmanager Issues and PRs that pertain to the networkmanager service. size/XL 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