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(_attachment): Handle errors on delete for resources deleted out-of-band #40790

Merged
merged 8 commits into from
Jan 6, 2025

Conversation

ewbankkit
Copy link
Contributor

@ewbankkit ewbankkit commented Jan 6, 2025

Description

Ibid.

Relations

Closes #40788.

Output from Acceptance Testing

% make testacc TESTARGS='-run=TestAccVPCInternetGatewayAttachment_\|TestAccVPCInternetGateway_' PKG=ec2 ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/ec2/... -v -count 1 -parallel 3  -run=TestAccVPCInternetGatewayAttachment_\|TestAccVPCInternetGateway_ -timeout 360m
2025/01/06 10:33:27 Initializing Terraform AWS Provider...
=== RUN   TestAccVPCInternetGatewayAttachment_basic
=== PAUSE TestAccVPCInternetGatewayAttachment_basic
=== RUN   TestAccVPCInternetGatewayAttachment_disappears
=== PAUSE TestAccVPCInternetGatewayAttachment_disappears
=== RUN   TestAccVPCInternetGatewayAttachment_Disappears_internetGateway
=== PAUSE TestAccVPCInternetGatewayAttachment_Disappears_internetGateway
=== RUN   TestAccVPCInternetGateway_basic
=== PAUSE TestAccVPCInternetGateway_basic
=== RUN   TestAccVPCInternetGateway_disappears
=== PAUSE TestAccVPCInternetGateway_disappears
=== RUN   TestAccVPCInternetGateway_Disappears_attachment
=== PAUSE TestAccVPCInternetGateway_Disappears_attachment
=== RUN   TestAccVPCInternetGateway_attachment
=== PAUSE TestAccVPCInternetGateway_attachment
=== RUN   TestAccVPCInternetGateway_tags
=== PAUSE TestAccVPCInternetGateway_tags
=== CONT  TestAccVPCInternetGatewayAttachment_basic
=== CONT  TestAccVPCInternetGateway_disappears
=== CONT  TestAccVPCInternetGateway_attachment
--- PASS: TestAccVPCInternetGateway_disappears (11.58s)
=== CONT  TestAccVPCInternetGatewayAttachment_Disappears_internetGateway
--- PASS: TestAccVPCInternetGatewayAttachment_basic (17.28s)
=== CONT  TestAccVPCInternetGateway_basic
--- PASS: TestAccVPCInternetGatewayAttachment_Disappears_internetGateway (15.66s)
=== CONT  TestAccVPCInternetGateway_Disappears_attachment
--- PASS: TestAccVPCInternetGateway_attachment (27.82s)
=== CONT  TestAccVPCInternetGateway_tags
--- PASS: TestAccVPCInternetGateway_basic (12.71s)
=== CONT  TestAccVPCInternetGatewayAttachment_disappears
--- PASS: TestAccVPCInternetGateway_Disappears_attachment (15.25s)
--- PASS: TestAccVPCInternetGatewayAttachment_disappears (15.26s)
--- PASS: TestAccVPCInternetGateway_tags (28.16s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	61.543s

% make testacc TESTARGS='-run=TestAccVPCInternetGateway_Disappears_attachment' PKG=ec2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/ec2/... -v -count 1 -parallel 20  -run=TestAccVPCInternetGateway_Disappears_attachment -timeout 360m
2025/01/06 10:04:50 Initializing Terraform AWS Provider...
=== RUN   TestAccVPCInternetGateway_Disappears_attachment
=== PAUSE TestAccVPCInternetGateway_Disappears_attachment
=== CONT  TestAccVPCInternetGateway_Disappears_attachment
    vpc_internet_gateway_test.go:82: Error running post-test destroy, there may be dangling resources: exit status 1

        Error: deleting EC2 Internet Gateway (igw-0682ac83f04b9fc1c): detaching EC2 Internet Gateway (igw-0682ac83f04b9fc1c) from VPC (vpc-0499f1f97a3a98aaf): operation error EC2: DetachInternetGateway, https response error StatusCode: 400, RequestID: f11d89d3-ac15-4001-946c-448a30112030, api error InvalidInternetGatewayID.NotFound: The internetGateway ID 'igw-0682ac83f04b9fc1c' does not exist

--- FAIL: TestAccVPCInternetGateway_Disappears_attachment (16.09s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	21.891s
FAIL
make: *** [testacc] Error 1
% make testacc TESTARGS='-run=TestAccVPCInternetGatewayAttachment_Disappears_internetGateway' PKG=ec2
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/ec2/... -v -count 1 -parallel 20  -run=TestAccVPCInternetGatewayAttachment_Disappears_internetGateway -timeout 360m
2025/01/06 10:13:39 Initializing Terraform AWS Provider...
=== RUN   TestAccVPCInternetGatewayAttachment_Disappears_internetGateway
=== PAUSE TestAccVPCInternetGatewayAttachment_Disappears_internetGateway
=== CONT  TestAccVPCInternetGatewayAttachment_Disappears_internetGateway
    vpc_internet_gateway_attachment_test.go:84: Error running post-test destroy, there may be dangling resources: exit status 1

        Error: deleting EC2 Internet Gateway Attachment (igw-0a6b48db0c404fcde:vpc-01e1cfd3e2b527c6a): detaching EC2 Internet Gateway (igw-0a6b48db0c404fcde) from VPC (vpc-01e1cfd3e2b527c6a): operation error EC2: DetachInternetGateway, https response error StatusCode: 400, RequestID: 638bd655-5821-4c72-90a7-9f5f49e21040, api error InvalidInternetGatewayID.NotFound: The internetGateway ID 'igw-0a6b48db0c404fcde' does not exist

--- FAIL: TestAccVPCInternetGatewayAttachment_Disappears_internetGateway (14.83s)
FAIL
FAIL	github.com/hashicorp/terraform-provider-aws/internal/service/ec2	20.663s
FAIL
make: *** [testacc] Error 1
…teway, ..., api error InvalidInternetGatewayID.NotFound: ...' errors on Delete.
…hInternetGateway, ..., api error InvalidInternetGatewayID.NotFound: ...' errors on Delete.
@ewbankkit ewbankkit requested a review from a team as a code owner January 6, 2025 15:31
Copy link

github-actions bot commented Jan 6, 2025

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. labels Jan 6, 2025
@github-actions github-actions bot added the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jan 6, 2025
@ewbankkit ewbankkit added the bug Addresses a defect in current functionality. label Jan 6, 2025
Copy link
Member

@jar-b jar-b 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="TestAccVPCInternetGatewayAttachment_|TestAccVPCInternetGateway_"
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.23.3 test ./internal/service/ec2/... -v -count 1 -parallel 20 -run='TestAccVPCInternetGatewayAttachment_|TestAccVPCInternetGateway_'  -timeout 360

--- PASS: TestAccVPCInternetGateway_disappears (16.19s)
--- PASS: TestAccVPCInternetGateway_basic (18.92s)
--- PASS: TestAccVPCInternetGatewayAttachment_disappears (20.37s)
--- PASS: TestAccVPCInternetGateway_Disappears_attachment (21.27s)
--- PASS: TestAccVPCInternetGatewayAttachment_Disappears_internetGateway (21.31s)
--- PASS: TestAccVPCInternetGatewayAttachment_basic (22.17s)
--- PASS: TestAccVPCInternetGateway_attachment (34.29s)
--- PASS: TestAccVPCInternetGateway_tags (35.97s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/ec2        41.630s

@ewbankkit ewbankkit merged commit 327a8fb into main Jan 6, 2025
54 checks passed
@ewbankkit ewbankkit deleted the b-aws_internet_gateway-delete branch January 6, 2025 18:52
@github-actions github-actions bot added this to the v5.83.0 milestone Jan 6, 2025
terraform-aws-provider bot pushed a commit that referenced this pull request Jan 6, 2025
Copy link

github-actions bot commented Jan 9, 2025

This functionality has been released in v5.83.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 Jan 9, 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. 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.

r/aws_internet_gateway: Error deleting already deleted resource that had an attachment
2 participants