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_rds_cluster: allow restore via cluster_resource_id to restore deleted clusters #38540

Conversation

aristosvo
Copy link
Contributor

@aristosvo aristosvo commented Jul 25, 2024

Description

restore_to_point_in_time has already a source_cluster_identifier parameter, but this has one major drawback, as specified in the AWS SDK: it must match the identifier of an existing DBCluster.

This is not the case for the source_cluster_resource_id, which is unique (you can create, delete and recreate a cluster with the same ARN, which will have different resource IDs). Restore of an automated backup of a deleted database cluster is only possible with source_cluster_resource_id.

Relations

Fixes #38549

References

Output from Acceptance Testing

% make testacc TESTS=TestAccRDSCluster_pointInTimeRestoreViaResourceID PKG=rds
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/rds/... -v -count 1 -parallel 20 -run='TestAccRDSCluster_pointInTimeRestoreViaResourceID'  -timeout 360m
=== RUN   TestAccRDSCluster_pointInTimeRestoreViaResourceID
=== PAUSE TestAccRDSCluster_pointInTimeRestoreViaResourceID
=== CONT  TestAccRDSCluster_pointInTimeRestoreViaResourceID
--- PASS: TestAccRDSCluster_pointInTimeRestoreViaResourceID (339.79s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/rds       344.181s

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.

@terraform-aws-provider terraform-aws-provider bot added tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/rds Issues and PRs that pertain to the rds service. size/M Managed by automation to categorize the size of a PR. labels Jul 25, 2024
@aristosvo aristosvo marked this pull request as ready for review July 25, 2024 18:23
@aristosvo aristosvo requested a review from a team as a code owner July 25, 2024 18:23
@aristosvo aristosvo force-pushed the f-aws_rds_cluster-cluster_restore_via_resourceid branch from 43f011f to 08186cd Compare July 25, 2024 20:05
@terraform-aws-provider terraform-aws-provider bot added the documentation Introduces or discusses updates to documentation. label Jul 26, 2024
Copy link
Member

@bschaatsbergen bschaatsbergen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

Note, syntax-wise the PR looks good. I’m trying to better understand the exact problem you’ve outlined and why source_cluster_identifier is required in the AWS API specification. Other than that, it looks good.

@bschaatsbergen
Copy link
Member

As always, @aristosvo, thank you for your time and valuable contributions.

@ewbankkit ewbankkit self-assigned this Jul 29, 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.

@aristosvo Thanks for the contribution 🎉 👏.

% make testacc TESTARGS='-run=TestAccRDSCluster_basic\|TestAccRDSCluster_pointInTimeRestore' PKG=rds
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/rds/... -v -count 1 -parallel 20  -run=TestAccRDSCluster_basic\|TestAccRDSCluster_pointInTimeRestore -timeout 360m
=== RUN   TestAccRDSCluster_basic
=== PAUSE TestAccRDSCluster_basic
=== RUN   TestAccRDSCluster_pointInTimeRestore
=== PAUSE TestAccRDSCluster_pointInTimeRestore
=== RUN   TestAccRDSCluster_pointInTimeRestoreViaResourceID
=== PAUSE TestAccRDSCluster_pointInTimeRestoreViaResourceID
=== CONT  TestAccRDSCluster_basic
=== CONT  TestAccRDSCluster_pointInTimeRestoreViaResourceID
=== CONT  TestAccRDSCluster_pointInTimeRestore
--- PASS: TestAccRDSCluster_basic (118.83s)
--- PASS: TestAccRDSCluster_pointInTimeRestoreViaResourceID (325.84s)
--- PASS: TestAccRDSCluster_pointInTimeRestore (328.22s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	333.260s
% make testacc TESTARGS='-run=TestAccRDSCustomDBEngineVersion_' PKG=rds
make: Verifying source code with gofmt...
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go1.22.5 test ./internal/service/rds/... -v -count 1 -parallel 20  -run=TestAccRDSCustomDBEngineVersion_ -timeout 360m
=== RUN   TestAccRDSCustomDBEngineVersion_sqlServer
    custom_db_engine_version_test.go:36: Environment variable RDS_CUSTOM_WINDOWS_SQLSERVER_AMI is not set
--- SKIP: TestAccRDSCustomDBEngineVersion_sqlServer (0.00s)
=== RUN   TestAccRDSCustomDBEngineVersion_sqlServerUpdate
    custom_db_engine_version_test.go:81: Environment variable RDS_CUSTOM_WINDOWS_SQLSERVER_AMI is not set
--- SKIP: TestAccRDSCustomDBEngineVersion_sqlServerUpdate (0.00s)
=== RUN   TestAccRDSCustomDBEngineVersion_oracle
    custom_db_engine_version_test.go:136: Environment variable RDS_CUSTOM_ORACLE_S3_BUCKET is not set
--- SKIP: TestAccRDSCustomDBEngineVersion_oracle (0.00s)
=== RUN   TestAccRDSCustomDBEngineVersion_manifestFile
    custom_db_engine_version_test.go:181: Environment variable RDS_CUSTOM_ORACLE_S3_BUCKET is not set
--- SKIP: TestAccRDSCustomDBEngineVersion_manifestFile (0.00s)
=== RUN   TestAccRDSCustomDBEngineVersion_tags
    custom_db_engine_version_test.go:226: Environment variable RDS_CUSTOM_WINDOWS_SQLSERVER_AMI is not set
--- SKIP: TestAccRDSCustomDBEngineVersion_tags (0.00s)
=== RUN   TestAccRDSCustomDBEngineVersion_disappears
    custom_db_engine_version_test.go:263: Environment variable RDS_CUSTOM_WINDOWS_SQLSERVER_AMI is not set
--- SKIP: TestAccRDSCustomDBEngineVersion_disappears (0.00s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	4.941s

@ewbankkit ewbankkit added the enhancement Requests to existing resources that expand the functionality or scope. label Jul 29, 2024
@ewbankkit ewbankkit merged commit 892d747 into hashicorp:main Jul 29, 2024
48 checks passed
@github-actions github-actions bot added this to the v5.61.0 milestone Jul 29, 2024
Copy link

github-actions bot commented Aug 2, 2024

This functionality has been released in v5.61.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 Sep 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 Sep 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Introduces or discusses updates to documentation. enhancement Requests to existing resources that expand the functionality or scope. service/rds Issues and PRs that pertain to the rds service. size/M 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
Development

Successfully merging this pull request may close these issues.

[Enhancement]: enable restore to point in time on aws_rds_cluster based on cluster_resource_id
3 participants