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 aws_ec2_capacity_reservation causing failure if removed outside Terraform #37127

Merged
merged 4 commits into from
Jun 11, 2024

Conversation

dhrkumar
Copy link
Contributor

Description

Fix a bug where if a capacity reservation is deleted/removed from AWS account outside Terraform while the resource is still in Terraform state, refresh/read and delete actions result in failure.

Relations

Closes #36716

References

Output from Acceptance Testing

% make testacc TESTS='TestAccEC2CapacityReservation_' PKG=ec2 ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/ec2/... -v -count 1 -parallel 3 -run='TestAccEC2CapacityReservation_'  -timeout 360m
=== RUN   TestAccEC2CapacityReservation_basic
=== PAUSE TestAccEC2CapacityReservation_basic
=== RUN   TestAccEC2CapacityReservation_disappears
=== PAUSE TestAccEC2CapacityReservation_disappears
=== RUN   TestAccEC2CapacityReservation_ebsOptimized
=== PAUSE TestAccEC2CapacityReservation_ebsOptimized
=== RUN   TestAccEC2CapacityReservation_endDate
=== PAUSE TestAccEC2CapacityReservation_endDate
=== RUN   TestAccEC2CapacityReservation_endDateType
=== PAUSE TestAccEC2CapacityReservation_endDateType
=== RUN   TestAccEC2CapacityReservation_ephemeralStorage
=== PAUSE TestAccEC2CapacityReservation_ephemeralStorage
=== RUN   TestAccEC2CapacityReservation_instanceCount
=== PAUSE TestAccEC2CapacityReservation_instanceCount
=== RUN   TestAccEC2CapacityReservation_instanceMatchCriteria
=== PAUSE TestAccEC2CapacityReservation_instanceMatchCriteria
=== RUN   TestAccEC2CapacityReservation_instanceType
=== PAUSE TestAccEC2CapacityReservation_instanceType
=== RUN   TestAccEC2CapacityReservation_tags
=== PAUSE TestAccEC2CapacityReservation_tags
=== RUN   TestAccEC2CapacityReservation_tenancy
=== PAUSE TestAccEC2CapacityReservation_tenancy
=== CONT  TestAccEC2CapacityReservation_basic
=== CONT  TestAccEC2CapacityReservation_instanceCount
=== CONT  TestAccEC2CapacityReservation_tags
--- PASS: TestAccEC2CapacityReservation_basic (41.20s)
=== CONT  TestAccEC2CapacityReservation_tenancy
--- PASS: TestAccEC2CapacityReservation_instanceCount (61.91s)
=== CONT  TestAccEC2CapacityReservation_endDate
--- PASS: TestAccEC2CapacityReservation_tenancy (34.84s)
=== CONT  TestAccEC2CapacityReservation_ephemeralStorage
--- PASS: TestAccEC2CapacityReservation_tags (77.91s)
=== CONT  TestAccEC2CapacityReservation_endDateType
--- PASS: TestAccEC2CapacityReservation_ephemeralStorage (33.46s)
=== CONT  TestAccEC2CapacityReservation_ebsOptimized
--- PASS: TestAccEC2CapacityReservation_endDate (50.96s)
=== CONT  TestAccEC2CapacityReservation_disappears
--- PASS: TestAccEC2CapacityReservation_ebsOptimized (32.74s)
=== CONT  TestAccEC2CapacityReservation_instanceType
--- PASS: TestAccEC2CapacityReservation_disappears (31.19s)
=== CONT  TestAccEC2CapacityReservation_instanceMatchCriteria
--- PASS: TestAccEC2CapacityReservation_endDateType (73.28s)
--- PASS: TestAccEC2CapacityReservation_instanceMatchCriteria (33.24s)
--- PASS: TestAccEC2CapacityReservation_instanceType (49.51s)
PASS
ok   [github.com/hashicorp/terraform-provider-aws/internal/service/ec2](http://github.com/hashicorp/terraform-provider-aws/internal/service/ec2) 191.983s

...

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 the size/XS Managed by automation to categorize the size of a PR. label Apr 26, 2024
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Apr 26, 2024
@dhrkumar dhrkumar marked this pull request as ready for review April 26, 2024 15:34
@justinretzolk justinretzolk added bug Addresses a defect in current functionality. service/ec2 Issues and PRs that pertain to the ec2 service. and removed needs-triage Waiting for first response or review from a maintainer. labels Apr 26, 2024
@dhrkumar
Copy link
Contributor Author

dhrkumar commented May 7, 2024

@ewbankkit please review this small bug fix contribution

@dhrkumar
Copy link
Contributor Author

dhrkumar commented Jun 7, 2024

@ewbankkit @justinretzolk can this extra small bug fix be reviewed and merged? It cause issues in refresh and resource has to be manually removed from state file.

@ewbankkit ewbankkit self-assigned this Jun 7, 2024
@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 Jun 7, 2024
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 🚀.

# Conflicts:
#	internal/service/ec2/errors.go
@ewbankkit
Copy link
Contributor

@dhrkumar Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit b1249d2 into hashicorp:main Jun 11, 2024
28 checks passed
@github-actions github-actions bot added this to the v5.54.0 milestone Jun 11, 2024
@github-actions github-actions bot removed the prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. label Jun 14, 2024
Copy link

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

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 Jul 15, 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. service/ec2 Issues and PRs that pertain to the ec2 service. size/XS Managed by automation to categorize the size of a PR.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Terraform plan fails when capacity reservation is removed outside of terraform
3 participants