-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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_db_instance: Fix resource leak on error during creation. #38252
r/aws_db_instance: Fix resource leak on error during creation. #38252
Conversation
Community NoteVoting for Prioritization
For Submitters
|
9fa1dc5
to
ddd8d36
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Welcome @mergenci 👋
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! 😃
There was a problem hiding this 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=TestAccRDSInstance_basic\|TestAccRDSInstance_ReplicateSourceDB_basic\|TestAccRDSInstance_SnapshotIdentifier_basic\|TestAccRDSInstance_RestoreToPointInTime_sourceIdentifier' PKG=rds ACCTEST_PARALLELISM=3
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.4 test ./internal/service/rds/... -v -count 1 -parallel 3 -run=TestAccRDSInstance_basic\|TestAccRDSInstance_ReplicateSourceDB_basic\|TestAccRDSInstance_SnapshotIdentifier_basic\|TestAccRDSInstance_RestoreToPointInTime_sourceIdentifier -timeout 360m
=== RUN TestAccRDSInstance_basic
=== PAUSE TestAccRDSInstance_basic
=== RUN TestAccRDSInstance_ReplicateSourceDB_basic
=== PAUSE TestAccRDSInstance_ReplicateSourceDB_basic
=== RUN TestAccRDSInstance_SnapshotIdentifier_basic
=== PAUSE TestAccRDSInstance_SnapshotIdentifier_basic
=== RUN TestAccRDSInstance_RestoreToPointInTime_sourceIdentifier
=== PAUSE TestAccRDSInstance_RestoreToPointInTime_sourceIdentifier
=== CONT TestAccRDSInstance_basic
=== CONT TestAccRDSInstance_SnapshotIdentifier_basic
=== CONT TestAccRDSInstance_ReplicateSourceDB_basic
--- PASS: TestAccRDSInstance_basic (529.25s)
=== CONT TestAccRDSInstance_RestoreToPointInTime_sourceIdentifier
--- PASS: TestAccRDSInstance_SnapshotIdentifier_basic (1310.36s)
--- PASS: TestAccRDSInstance_ReplicateSourceDB_basic (1576.76s)
--- PASS: TestAccRDSInstance_RestoreToPointInTime_sourceIdentifier (1356.82s)
PASS
ok github.com/hashicorp/terraform-provider-aws/internal/service/rds 1890.883s
@mergenci Thanks for the contribution 🎉 👏. |
Thank you @ewbankkit 🙏 I'm happy to also have the opportunity to learn from you. |
This functionality has been released in v5.58.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! |
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. |
Description
This PR saves RDS instance ID to terraform state upon an error while waiting for instance to become available after creation, so that the resource doesn't leak.
I implemented a one-liner fix for the sake of simplicity. From what I understand from Resource Contribution Guidelines, the instance ID should be set before the wait operation:
I would be happy to update my fix, if maintainers see the necessity.
After applying the fix, Terraform becomes aware that the resource exists and plans accordingly:
Relations
Closes #38251
References
Output from Acceptance Testing