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

r/aws_internet_gateway: continue to deletion when attachment not found #41346

Merged
merged 3 commits into from
Feb 12, 2025

Conversation

jar-b
Copy link
Member

@jar-b jar-b commented Feb 11, 2025

Description

This fixes a regression introduced in v5.83.0 which caused destruction of the aws_internet_gateway resource to exit early if an attempt to detach the internet gateway returned a not found error. Rather than exit early, the operation should just proceed after NotFound errors to allow the internet gateway to be deleted.

Also updates the _Disappears_attachment acceptance test to delete a standalone attachment out-of-band, rather than the entire internet gateway.

Relations

Closes #41327
Relates #40790

References

Output from Acceptance Testing

% make testacc PKG=ec2 TESTS=TestAccVPCInternetGateway_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCInternetGateway_'  -timeout 360m -vet=off
2025/02/11 16:45:34 Initializing Terraform AWS Provider...

--- PASS: TestAccVPCInternetGateway_disappears (13.68s)
--- PASS: TestAccVPCInternetGateway_basic (15.96s)
--- PASS: TestAccVPCInternetGateway_Disappears_attachment (18.03s)
--- PASS: TestAccVPCInternetGateway_attachment (30.32s)
--- PASS: TestAccVPCInternetGateway_tags (32.52s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ec2        39.413s

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/vpc Issues and PRs that pertain to the vpc service. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. labels Feb 11, 2025
This fixes a regression introduced in `v5.83.0` which caused destruction of the `aws_internet_gateway` resource to exit early if an attempt to detach the internet gateway returned a not found error. Rather than exit early, the operation should just proceed after `NotFound` errors to allow the internet gateway to be deleted.

```console
% make testacc PKG=ec2 TESTS=TestAccVPCInternetGateway_
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCInternetGateway_'  -timeout 360m -vet=off
2025/02/11 16:45:34 Initializing Terraform AWS Provider...

--- PASS: TestAccVPCInternetGateway_disappears (13.68s)
--- PASS: TestAccVPCInternetGateway_basic (15.96s)
--- PASS: TestAccVPCInternetGateway_Disappears_attachment (18.03s)
--- PASS: TestAccVPCInternetGateway_attachment (30.32s)
--- PASS: TestAccVPCInternetGateway_tags (32.52s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ec2        39.413s
```
Previously this test was deleting the internet gateway out-of-band, rather than just the attachment. The configuration has been updated to use a standalone `aws_internet_gateway_attachment` resource which, is deleted out-of-band.

```console
% make testacc PKG=ec2 TESTS=TestAccVPCInternetGateway_Disappears_attachment
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCInternetGateway_Disappears_attachment'  -timeout 360m -vet=off
2025/02/11 16:56:26 Initializing Terraform AWS Provider...

--- PASS: TestAccVPCInternetGateway_Disappears_attachment (16.45s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ec2        23.302s
```
@jar-b jar-b added bug Addresses a defect in current functionality. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. labels Feb 11, 2025
@jar-b jar-b marked this pull request as ready for review February 12, 2025 14:44
@jar-b jar-b requested a review from a team as a code owner February 12, 2025 14:44
Copy link
Contributor

@johnsonaj johnsonaj 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 PKG=ec2 TESTS=TestAccVPCInternetGateway_

make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.5 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCInternetGateway_'  -timeout 360m -vet=off
2025/02/12 10:26:54 Initializing Terraform AWS Provider...
--- PASS: TestAccVPCInternetGateway_disappears (14.04s)
--- PASS: TestAccVPCInternetGateway_basic (16.03s)
--- PASS: TestAccVPCInternetGateway_Disappears_attachment (17.23s)
--- PASS: TestAccVPCInternetGateway_attachment (29.32s)
--- PASS: TestAccVPCInternetGateway_tags (31.85s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	38.745s

@jar-b jar-b merged commit a627dd1 into main Feb 12, 2025
57 checks passed
@jar-b jar-b deleted the b-ig-destroy branch February 12, 2025 16:38
@github-actions github-actions bot added this to the v5.87.0 milestone Feb 12, 2025
terraform-aws-provider bot pushed a commit that referenced this pull request Feb 12, 2025
Copy link

This functionality has been released in v5.87.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 github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Feb 14, 2025
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. regression Pertains to a degraded workflow resulting from an upstream patch or internal enhancement. service/vpc Issues and PRs that pertain to the vpc service. 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.

[Bug]: Internet Gateway is not been deleted, only detached
2 participants