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

Add shared_accounts parameter to db_snapshot_copy #34843

Merged
merged 32 commits into from
Jul 25, 2024

Conversation

OpenGLShaders
Copy link
Contributor

@OpenGLShaders OpenGLShaders commented Dec 10, 2023

Description

Adds support for sharing an RDS snapshot copy (this behavior is already enabled for snapshots) across accounts, including public access by using ["all"]. This is in line with what exists already for aws_db_snapshot.

Relations

Closes #31212.
Relates #36200.

References

Output from Acceptance Testing

make testacc TESTS=TestAccRDSSnapshotCopy_ PKG=rds
TF_ACC=1 go test ./internal/service/rds/... -v -count 1 -parallel 20 -run='TestAccRDSSnapshotCopy_'  -timeout 360m
--- PASS: TestAccRDSSnapshotCopy_basic (970.36s)
--- PASS: TestAccRDSSnapshotCopy_disappears (974.66s)
--- PASS: TestAccRDSSnapshotCopy_share (1144.07s)
--- PASS: TestAccRDSSnapshotCopy_tags (1362.12s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/rds        1365.197s

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 size/M Managed by automation to categorize the size of a PR. documentation Introduces or discusses updates to documentation. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/rds Issues and PRs that pertain to the rds service. and removed size/M Managed by automation to categorize the size of a PR. labels Dec 10, 2023
@OpenGLShaders OpenGLShaders changed the title Sk/31212 Add shared_accounts parameter to db_snapshot_copy Dec 10, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Dec 10, 2023
@github-actions github-actions bot added the size/M Managed by automation to categorize the size of a PR. label Dec 10, 2023
Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome @OpenGLShaders 👋

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! 😃

@justinretzolk justinretzolk added enhancement Requests to existing resources that expand the functionality or scope. and removed needs-triage Waiting for first response or review from a maintainer. labels Dec 12, 2023
@raelga
Copy link

raelga commented Jan 19, 2024

This feature will be awesome, to share snapshots using an intermediary KMS key.

ewbankkit added 13 commits July 23, 2024 15:50
% make testacc TESTARGS='-run=TestAccRDSSnapshot_\|TestAccRDSSnapshotCopy_' PKG=rds ACCTEST_PARALLELISM=3
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 3  -run=TestAccRDSSnapshot_\|TestAccRDSSnapshotCopy_ -timeout 360m
=== RUN   TestAccRDSSnapshotCopy_basic
=== PAUSE TestAccRDSSnapshotCopy_basic
=== RUN   TestAccRDSSnapshotCopy_share
=== PAUSE TestAccRDSSnapshotCopy_share
=== RUN   TestAccRDSSnapshotCopy_tags
=== PAUSE TestAccRDSSnapshotCopy_tags
=== RUN   TestAccRDSSnapshotCopy_disappears
=== PAUSE TestAccRDSSnapshotCopy_disappears
=== RUN   TestAccRDSSnapshot_basic
=== PAUSE TestAccRDSSnapshot_basic
=== RUN   TestAccRDSSnapshot_share
=== PAUSE TestAccRDSSnapshot_share
=== RUN   TestAccRDSSnapshot_tags
=== PAUSE TestAccRDSSnapshot_tags
=== RUN   TestAccRDSSnapshot_disappears
=== PAUSE TestAccRDSSnapshot_disappears
=== CONT  TestAccRDSSnapshotCopy_basic
=== CONT  TestAccRDSSnapshot_basic
=== CONT  TestAccRDSSnapshotCopy_tags
--- PASS: TestAccRDSSnapshot_basic (672.32s)
=== CONT  TestAccRDSSnapshotCopy_disappears
--- PASS: TestAccRDSSnapshotCopy_basic (722.32s)
=== CONT  TestAccRDSSnapshot_tags
--- PASS: TestAccRDSSnapshotCopy_tags (750.45s)
=== CONT  TestAccRDSSnapshot_disappears
--- PASS: TestAccRDSSnapshotCopy_disappears (749.22s)
=== CONT  TestAccRDSSnapshot_share
--- PASS: TestAccRDSSnapshot_tags (780.17s)
=== CONT  TestAccRDSSnapshotCopy_share
--- PASS: TestAccRDSSnapshot_disappears (880.85s)
--- PASS: TestAccRDSSnapshot_share (745.66s)
--- PASS: TestAccRDSSnapshotCopy_share (920.40s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	2427.826s
% make testacc TESTARGS='-run=TestAccRDSSnapshot_\|TestAccRDSSnapshotCopy_' PKG=rds ACCTEST_PARALLELISM=3
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 3  -run=TestAccRDSSnapshot_\|TestAccRDSSnapshotCopy_ -timeout 360m
=== RUN   TestAccRDSSnapshotCopy_basic
=== PAUSE TestAccRDSSnapshotCopy_basic
=== RUN   TestAccRDSSnapshotCopy_share
=== PAUSE TestAccRDSSnapshotCopy_share
=== RUN   TestAccRDSSnapshotCopy_tags
=== PAUSE TestAccRDSSnapshotCopy_tags
=== RUN   TestAccRDSSnapshotCopy_disappears
=== PAUSE TestAccRDSSnapshotCopy_disappears
=== RUN   TestAccRDSSnapshot_basic
=== PAUSE TestAccRDSSnapshot_basic
=== RUN   TestAccRDSSnapshot_share
=== PAUSE TestAccRDSSnapshot_share
=== RUN   TestAccRDSSnapshot_tags
=== PAUSE TestAccRDSSnapshot_tags
=== RUN   TestAccRDSSnapshot_disappears
=== PAUSE TestAccRDSSnapshot_disappears
=== CONT  TestAccRDSSnapshotCopy_basic
=== CONT  TestAccRDSSnapshot_basic
=== CONT  TestAccRDSSnapshotCopy_tags
--- PASS: TestAccRDSSnapshot_basic (663.28s)
=== CONT  TestAccRDSSnapshotCopy_share
--- PASS: TestAccRDSSnapshotCopy_tags (665.45s)
=== CONT  TestAccRDSSnapshotCopy_disappears
--- PASS: TestAccRDSSnapshotCopy_basic (857.90s)
=== CONT  TestAccRDSSnapshot_tags
--- PASS: TestAccRDSSnapshotCopy_disappears (485.91s)
=== CONT  TestAccRDSSnapshot_disappears
--- PASS: TestAccRDSSnapshotCopy_share (507.17s)
=== CONT  TestAccRDSSnapshot_share
--- PASS: TestAccRDSSnapshot_tags (468.80s)
--- PASS: TestAccRDSSnapshot_disappears (231.80s)
--- PASS: TestAccRDSSnapshot_share (228.36s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	1403.830s
% make testacc TESTARGS='-run=TestAccRDSSnapshotCopy_destinationRegion' 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=TestAccRDSSnapshotCopy_destinationRegion -timeout 360m
=== RUN   TestAccRDSSnapshotCopy_destinationRegion
=== PAUSE TestAccRDSSnapshotCopy_destinationRegion
=== CONT  TestAccRDSSnapshotCopy_destinationRegion
--- PASS: TestAccRDSSnapshotCopy_destinationRegion (768.14s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	772.855s
@ewbankkit ewbankkit requested a review from a team as a code owner July 25, 2024 18:11
@terraform-aws-provider terraform-aws-provider bot added sweeper Pertains to changes to or issues with the sweeper. generators Relates to code generators. size/XL Managed by automation to categorize the size of a PR. and removed size/M Managed by automation to categorize the size of a PR. labels Jul 25, 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 🚀.

% make testacc TESTARGS='-run=TestAccRDSSnapshot_\|TestAccRDSSnapshotCopy_\|TestAccRDSInstanceOffering_\|TestAccRDSParameterGroup_\|TestAccRDSClusterParameterGroup_\|TestAccRDSClusterEndpoint_\|TestAccRDSClusterRoleAssociation_' PKG=rds ACCTEST_PARALLELISM=4
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 4  -run=TestAccRDSSnapshot_\|TestAccRDSSnapshotCopy_\|TestAccRDSInstanceOffering_\|TestAccRDSParameterGroup_\|TestAccRDSClusterParameterGroup_\|TestAccRDSClusterEndpoint_\|TestAccRDSClusterRoleAssociation_ -timeout 360m
=== RUN   TestAccRDSClusterEndpoint_basic
=== PAUSE TestAccRDSClusterEndpoint_basic
=== RUN   TestAccRDSClusterEndpoint_tags
=== PAUSE TestAccRDSClusterEndpoint_tags
=== RUN   TestAccRDSClusterParameterGroup_basic
=== PAUSE TestAccRDSClusterParameterGroup_basic
=== RUN   TestAccRDSClusterParameterGroup_disappears
=== PAUSE TestAccRDSClusterParameterGroup_disappears
=== RUN   TestAccRDSClusterParameterGroup_tags
=== PAUSE TestAccRDSClusterParameterGroup_tags
=== RUN   TestAccRDSClusterParameterGroup_withApplyMethod
=== PAUSE TestAccRDSClusterParameterGroup_withApplyMethod
=== RUN   TestAccRDSClusterParameterGroup_namePrefix
=== PAUSE TestAccRDSClusterParameterGroup_namePrefix
=== RUN   TestAccRDSClusterParameterGroup_NamePrefix_parameter
=== PAUSE TestAccRDSClusterParameterGroup_NamePrefix_parameter
=== RUN   TestAccRDSClusterParameterGroup_generatedName
=== PAUSE TestAccRDSClusterParameterGroup_generatedName
=== RUN   TestAccRDSClusterParameterGroup_GeneratedName_parameter
=== PAUSE TestAccRDSClusterParameterGroup_GeneratedName_parameter
=== RUN   TestAccRDSClusterParameterGroup_only
=== PAUSE TestAccRDSClusterParameterGroup_only
=== RUN   TestAccRDSClusterParameterGroup_updateParameters
=== PAUSE TestAccRDSClusterParameterGroup_updateParameters
=== RUN   TestAccRDSClusterParameterGroup_caseParameters
=== PAUSE TestAccRDSClusterParameterGroup_caseParameters
=== RUN   TestAccRDSClusterParameterGroup_dynamicDiffs
=== PAUSE TestAccRDSClusterParameterGroup_dynamicDiffs
=== RUN   TestAccRDSClusterRoleAssociation_basic
=== PAUSE TestAccRDSClusterRoleAssociation_basic
=== RUN   TestAccRDSClusterRoleAssociation_disappears
=== PAUSE TestAccRDSClusterRoleAssociation_disappears
=== RUN   TestAccRDSClusterRoleAssociation_Disappears_cluster
=== PAUSE TestAccRDSClusterRoleAssociation_Disappears_cluster
=== RUN   TestAccRDSClusterRoleAssociation_Disappears_role
=== PAUSE TestAccRDSClusterRoleAssociation_Disappears_role
=== RUN   TestAccRDSParameterGroup_basic
=== PAUSE TestAccRDSParameterGroup_basic
=== RUN   TestAccRDSParameterGroup_disappears
=== PAUSE TestAccRDSParameterGroup_disappears
=== RUN   TestAccRDSParameterGroup_tags
=== PAUSE TestAccRDSParameterGroup_tags
=== RUN   TestAccRDSParameterGroup_caseWithMixedParameters
=== PAUSE TestAccRDSParameterGroup_caseWithMixedParameters
=== RUN   TestAccRDSParameterGroup_limit
=== PAUSE TestAccRDSParameterGroup_limit
=== RUN   TestAccRDSParameterGroup_namePrefix
=== PAUSE TestAccRDSParameterGroup_namePrefix
=== RUN   TestAccRDSParameterGroup_generatedName
=== PAUSE TestAccRDSParameterGroup_generatedName
=== RUN   TestAccRDSParameterGroup_withApplyMethod
=== PAUSE TestAccRDSParameterGroup_withApplyMethod
=== RUN   TestAccRDSParameterGroup_only
=== PAUSE TestAccRDSParameterGroup_only
=== RUN   TestAccRDSParameterGroup_matchDefault
=== PAUSE TestAccRDSParameterGroup_matchDefault
=== RUN   TestAccRDSParameterGroup_updateParameters
=== PAUSE TestAccRDSParameterGroup_updateParameters
=== RUN   TestAccRDSParameterGroup_caseParameters
=== PAUSE TestAccRDSParameterGroup_caseParameters
=== RUN   TestAccRDSInstanceOffering_basic
=== PAUSE TestAccRDSInstanceOffering_basic
=== RUN   TestAccRDSSnapshotCopy_basic
=== PAUSE TestAccRDSSnapshotCopy_basic
=== RUN   TestAccRDSSnapshotCopy_share
=== PAUSE TestAccRDSSnapshotCopy_share
=== RUN   TestAccRDSSnapshotCopy_tags
=== PAUSE TestAccRDSSnapshotCopy_tags
=== RUN   TestAccRDSSnapshotCopy_disappears
=== PAUSE TestAccRDSSnapshotCopy_disappears
=== RUN   TestAccRDSSnapshotCopy_destinationRegion
=== PAUSE TestAccRDSSnapshotCopy_destinationRegion
=== RUN   TestAccRDSSnapshot_basic
=== PAUSE TestAccRDSSnapshot_basic
=== RUN   TestAccRDSSnapshot_share
=== PAUSE TestAccRDSSnapshot_share
=== RUN   TestAccRDSSnapshot_tags
=== PAUSE TestAccRDSSnapshot_tags
=== RUN   TestAccRDSSnapshot_disappears
=== PAUSE TestAccRDSSnapshot_disappears
=== CONT  TestAccRDSClusterEndpoint_basic
=== CONT  TestAccRDSParameterGroup_tags
=== CONT  TestAccRDSClusterParameterGroup_only
=== CONT  TestAccRDSInstanceOffering_basic
    acctest.go:1624: skipping test for aws/us-west-2: Error running pre-apply plan: exit status 1
        
        Error: no matching RDS Reserved Instance Offering found
        
          with data.aws_rds_reserved_instance_offering.test,
          on terraform_plugin_test.tf line 12, in data "aws_rds_reserved_instance_offering" "test":
          12: data "aws_rds_reserved_instance_offering" "test" {
        
--- SKIP: TestAccRDSInstanceOffering_basic (1.87s)
=== CONT  TestAccRDSParameterGroup_withApplyMethod
--- PASS: TestAccRDSClusterParameterGroup_only (14.22s)
=== CONT  TestAccRDSParameterGroup_caseParameters
--- PASS: TestAccRDSParameterGroup_withApplyMethod (13.03s)
=== CONT  TestAccRDSParameterGroup_updateParameters
--- PASS: TestAccRDSParameterGroup_tags (32.39s)
=== CONT  TestAccRDSParameterGroup_matchDefault
--- PASS: TestAccRDSParameterGroup_caseParameters (20.50s)
=== CONT  TestAccRDSParameterGroup_only
--- PASS: TestAccRDSParameterGroup_updateParameters (22.39s)
=== CONT  TestAccRDSParameterGroup_namePrefix
--- PASS: TestAccRDSParameterGroup_matchDefault (12.43s)
=== CONT  TestAccRDSParameterGroup_generatedName
--- PASS: TestAccRDSParameterGroup_only (13.12s)
=== CONT  TestAccRDSClusterRoleAssociation_disappears
--- PASS: TestAccRDSParameterGroup_namePrefix (10.31s)
=== CONT  TestAccRDSParameterGroup_disappears
--- PASS: TestAccRDSParameterGroup_generatedName (10.52s)
=== CONT  TestAccRDSParameterGroup_basic
--- PASS: TestAccRDSParameterGroup_disappears (10.00s)
=== CONT  TestAccRDSClusterRoleAssociation_Disappears_role
--- PASS: TestAccRDSParameterGroup_basic (32.27s)
=== CONT  TestAccRDSClusterRoleAssociation_Disappears_cluster
--- PASS: TestAccRDSClusterRoleAssociation_Disappears_role (195.15s)
=== CONT  TestAccRDSClusterParameterGroup_withApplyMethod
--- PASS: TestAccRDSClusterRoleAssociation_disappears (214.03s)
=== CONT  TestAccRDSClusterParameterGroup_GeneratedName_parameter
--- PASS: TestAccRDSClusterRoleAssociation_Disappears_cluster (174.27s)
=== CONT  TestAccRDSClusterParameterGroup_generatedName
--- PASS: TestAccRDSClusterParameterGroup_withApplyMethod (13.61s)
=== CONT  TestAccRDSClusterParameterGroup_NamePrefix_parameter
--- PASS: TestAccRDSClusterParameterGroup_GeneratedName_parameter (12.88s)
=== CONT  TestAccRDSClusterParameterGroup_namePrefix
--- PASS: TestAccRDSClusterParameterGroup_generatedName (12.87s)
=== CONT  TestAccRDSClusterParameterGroup_dynamicDiffs
--- PASS: TestAccRDSClusterParameterGroup_NamePrefix_parameter (12.78s)
=== CONT  TestAccRDSClusterRoleAssociation_basic
--- PASS: TestAccRDSClusterParameterGroup_dynamicDiffs (9.92s)
=== CONT  TestAccRDSClusterParameterGroup_disappears
--- PASS: TestAccRDSClusterParameterGroup_namePrefix (12.43s)
=== CONT  TestAccRDSClusterParameterGroup_tags
--- PASS: TestAccRDSClusterParameterGroup_disappears (9.68s)
=== CONT  TestAccRDSSnapshotCopy_destinationRegion
--- PASS: TestAccRDSClusterParameterGroup_tags (28.28s)
=== CONT  TestAccRDSSnapshot_disappears
--- PASS: TestAccRDSClusterRoleAssociation_basic (226.75s)
=== CONT  TestAccRDSSnapshot_tags
--- PASS: TestAccRDSSnapshot_disappears (697.52s)
=== CONT  TestAccRDSSnapshot_share
--- PASS: TestAccRDSSnapshotCopy_destinationRegion (777.36s)
=== CONT  TestAccRDSSnapshot_basic
--- PASS: TestAccRDSSnapshot_tags (598.16s)
=== CONT  TestAccRDSSnapshotCopy_tags
--- PASS: TestAccRDSSnapshot_share (583.24s)
=== CONT  TestAccRDSSnapshotCopy_disappears
--- PASS: TestAccRDSSnapshot_basic (649.85s)
=== CONT  TestAccRDSClusterParameterGroup_caseParameters
--- PASS: TestAccRDSClusterParameterGroup_caseParameters (18.40s)
=== CONT  TestAccRDSParameterGroup_limit
--- PASS: TestAccRDSParameterGroup_limit (24.56s)
=== CONT  TestAccRDSClusterParameterGroup_basic
--- PASS: TestAccRDSClusterParameterGroup_basic (68.27s)
=== CONT  TestAccRDSClusterEndpoint_tags
--- PASS: TestAccRDSSnapshotCopy_tags (815.82s)
=== CONT  TestAccRDSSnapshotCopy_share
--- PASS: TestAccRDSClusterEndpoint_basic (1922.82s)
=== CONT  TestAccRDSParameterGroup_caseWithMixedParameters
--- PASS: TestAccRDSParameterGroup_caseWithMixedParameters (15.53s)
=== CONT  TestAccRDSClusterParameterGroup_updateParameters
--- PASS: TestAccRDSClusterParameterGroup_updateParameters (20.22s)
=== CONT  TestAccRDSSnapshotCopy_basic
--- PASS: TestAccRDSSnapshotCopy_disappears (931.56s)
--- PASS: TestAccRDSSnapshotCopy_share (634.63s)
--- PASS: TestAccRDSSnapshotCopy_basic (782.94s)
--- PASS: TestAccRDSClusterEndpoint_tags (1982.21s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	3820.510s

@ewbankkit
Copy link
Contributor

@OpenGLShaders Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 163cec4 into hashicorp:main Jul 25, 2024
30 checks passed
@github-actions github-actions bot added this to the v5.60.0 milestone Jul 25, 2024
Copy link

This functionality has been released in v5.60.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 Aug 26, 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. generators Relates to code generators. service/rds Issues and PRs that pertain to the rds service. size/XL Managed by automation to categorize the size of a PR. sweeper Pertains to changes to or issues with the sweeper. 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]: aws_db_snapshot_copy support for sharing snapshots
4 participants