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

Fixed creating aws_db_instance from snapshot or Point in Time Recovery with manage_master_password #33699

Merged
merged 6 commits into from
Oct 18, 2023

Conversation

gchristidis
Copy link
Contributor

Description

Creating an RDS DB instance from a snapshot or a restore point in time now handles manage_master_user_password and master_user_secret_kms_key_id if set by adding them as post creation modification actions to the instance.

Relations

Closes #31509

References

Output from Acceptance Testing

Two new tests added that now pass after modifications

% TF_ACC=1 go test ./internal/service/rds/... -v -count 1 -parallel 20 -run='(TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKmsKey|TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword)'  -timeout 360m
=== RUN   TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKmsKey
=== PAUSE TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKmsKey
=== RUN   TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword
=== PAUSE TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword
=== CONT  TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKmsKey
=== CONT  TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword
--- PASS: TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword (1484.87s)
--- PASS: TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKmsKey (1492.76s)
PASS
ok      github.com/hashicorp/terraform-provider-aws/internal/service/rds        1492.850s

@github-actions
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/L Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. service/rds Issues and PRs that pertain to the rds service. labels Sep 30, 2023
@terraform-aws-provider terraform-aws-provider bot added the needs-triage Waiting for first response or review from a maintainer. label Sep 30, 2023
@gchristidis gchristidis changed the title Fixed creating aws_db_instance snapshot or Point in Time Recovery with manage_master_password Fixed creating aws_db_instance from snapshot or Point in Time Recovery with manage_master_password Sep 30, 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 @gchristidis 👋

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

Copy link
Collaborator

@AdamTylerLynch AdamTylerLynch left a comment

Choose a reason for hiding this comment

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

Conditional Approval. Need to operate a broader set of tests to confirm.

@AdamTylerLynch
Copy link
Collaborator

LGTM (failures are related to mysql5.7 deprecation) 🚀

make testacc TESTARGS='-run=TestAccRDSInstance_basic\|TestAccRDSInstance_manage_password\|TestAccRDSInstance_ManagedMasterPassword_\|TestAccRDSInstance_password\|TestAccRDSInstanceDataSource_\|TestAccRDSClusterDataSource_\|TestAccRDSCluster_ManagedMasterPassword_\|TestAccRDSCluster_basic\|TestAccRDSCluster_SnapshotIdentifier_master' PKG=rds ACCTEST_PARALLELISM=3
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/rds/... -v -count 1 -parallel 3  -run=TestAccRDSInstance_basic\|TestAccRDSInstance_manage_password\|TestAccRDSInstance_ManagedMasterPassword_\|TestAccRDSInstance_password\|TestAccRDSInstanceDataSource_\|TestAccRDSClusterDataSource_\|TestAccRDSCluster_ManagedMasterPassword_\|TestAccRDSCluster_basic\|TestAccRDSCluster_SnapshotIdentifier_master -timeout 360m
=== RUN   TestAccRDSClusterDataSource_basic
=== PAUSE TestAccRDSClusterDataSource_basic
=== RUN   TestAccRDSClusterDataSource_ManagedMasterPassword_managed
=== PAUSE TestAccRDSClusterDataSource_ManagedMasterPassword_managed
=== RUN   TestAccRDSCluster_basic
=== PAUSE TestAccRDSCluster_basic
=== RUN   TestAccRDSCluster_ManagedMasterPassword_managed
=== PAUSE TestAccRDSCluster_ManagedMasterPassword_managed
=== RUN   TestAccRDSCluster_ManagedMasterPassword_managedSpecificKMSKey
=== PAUSE TestAccRDSCluster_ManagedMasterPassword_managedSpecificKMSKey
=== RUN   TestAccRDSCluster_ManagedMasterPassword_convertToManaged
=== PAUSE TestAccRDSCluster_ManagedMasterPassword_convertToManaged
=== RUN   TestAccRDSCluster_SnapshotIdentifier_masterPassword
=== PAUSE TestAccRDSCluster_SnapshotIdentifier_masterPassword
=== RUN   TestAccRDSCluster_SnapshotIdentifier_masterUsername
=== PAUSE TestAccRDSCluster_SnapshotIdentifier_masterUsername
=== RUN   TestAccRDSInstanceDataSource_basic
=== PAUSE TestAccRDSInstanceDataSource_basic
=== RUN   TestAccRDSInstanceDataSource_ManagedMasterPassword_managed
=== PAUSE TestAccRDSInstanceDataSource_ManagedMasterPassword_managed
=== RUN   TestAccRDSInstanceDataSource_tags
=== PAUSE TestAccRDSInstanceDataSource_tags
=== RUN   TestAccRDSInstance_basic
=== PAUSE TestAccRDSInstance_basic
=== RUN   TestAccRDSInstance_manage_password
=== PAUSE TestAccRDSInstance_manage_password
=== RUN   TestAccRDSInstance_password
=== PAUSE TestAccRDSInstance_password
=== RUN   TestAccRDSInstance_ManagedMasterPassword_managed
=== PAUSE TestAccRDSInstance_ManagedMasterPassword_managed
=== RUN   TestAccRDSInstance_ManagedMasterPassword_managedSpecificKMSKey
=== PAUSE TestAccRDSInstance_ManagedMasterPassword_managedSpecificKMSKey
=== RUN   TestAccRDSInstance_ManagedMasterPassword_convertToManaged
=== PAUSE TestAccRDSInstance_ManagedMasterPassword_convertToManaged
=== CONT  TestAccRDSClusterDataSource_basic
=== CONT  TestAccRDSInstanceDataSource_ManagedMasterPassword_managed
=== CONT  TestAccRDSCluster_ManagedMasterPassword_convertToManaged
    cluster_test.go:1762: Step 1/3 error: Error running apply: exit status 1

        Error: creating RDS Cluster (tf-acc-test-6681354154015109643): InvalidParameterCombination: The Parameter Group default.aurora-mysql5.7 with DBParameterGroupFamily aurora-mysql5.7 cannot be used for this instance. Please use a Parameter Group with DBParameterGroupFamily aurora-mysql8.0
                status code: 400, request id: 2362fe63-f1fd-4308-977b-71153964d58d

          with aws_rds_cluster.test,
          on terraform_plugin_test.tf line 2, in resource "aws_rds_cluster" "test":
           2: resource "aws_rds_cluster" "test" {

--- FAIL: TestAccRDSCluster_ManagedMasterPassword_convertToManaged (26.89s)
=== CONT  TestAccRDSInstance_password
=== NAME  TestAccRDSClusterDataSource_basic
    cluster_data_source_test.go:22: Step 1/1 error: Error running apply: exit status 1

        Error: creating RDS Cluster (tf-acc-test-4429682350378388793): InvalidParameterCombination: The Parameter Group default.aurora-mysql5.7 with DBParameterGroupFamily aurora-mysql5.7 cannot be used for this instance. Please use a Parameter Group with DBParameterGroupFamily aurora-mysql8.0
                status code: 400, request id: d3095ea4-764e-46ca-a4f8-192bae7d654c

          with aws_rds_cluster.test,
          on terraform_plugin_test.tf line 37, in resource "aws_rds_cluster" "test":
          37: resource "aws_rds_cluster" "test" {

--- FAIL: TestAccRDSClusterDataSource_basic (159.14s)
=== CONT  TestAccRDSInstance_ManagedMasterPassword_convertToManaged
--- PASS: TestAccRDSInstanceDataSource_ManagedMasterPassword_managed (787.01s)
=== CONT  TestAccRDSInstance_ManagedMasterPassword_managedSpecificKMSKey
--- PASS: TestAccRDSInstance_password (1013.11s)
=== CONT  TestAccRDSInstance_ManagedMasterPassword_managed
--- PASS: TestAccRDSInstance_ManagedMasterPassword_convertToManaged (891.26s)
=== CONT  TestAccRDSInstance_basic
--- PASS: TestAccRDSInstance_ManagedMasterPassword_managedSpecificKMSKey (717.89s)
=== CONT  TestAccRDSInstance_manage_password
--- PASS: TestAccRDSInstance_ManagedMasterPassword_managed (584.37s)
=== CONT  TestAccRDSCluster_SnapshotIdentifier_masterUsername
--- PASS: TestAccRDSInstance_basic (749.59s)
=== CONT  TestAccRDSInstanceDataSource_basic
--- PASS: TestAccRDSCluster_SnapshotIdentifier_masterUsername (505.88s)
=== CONT  TestAccRDSCluster_ManagedMasterPassword_managed
    cluster_test.go:1665: Step 1/2 error: Error running apply: exit status 1

        Error: creating RDS Cluster (tf-acc-test-5633041051149814409): InvalidParameterCombination: The Parameter Group default.aurora-mysql5.7 with DBParameterGroupFamily aurora-mysql5.7 cannot be used for this instance. Please use a Parameter Group with DBParameterGroupFamily aurora-mysql8.0
                status code: 400, request id: 9421dd93-e56a-454c-a6a9-a2f7091123f0

          with aws_rds_cluster.test,
          on terraform_plugin_test.tf line 2, in resource "aws_rds_cluster" "test":
           2: resource "aws_rds_cluster" "test" {

--- FAIL: TestAccRDSCluster_ManagedMasterPassword_managed (21.37s)
=== CONT  TestAccRDSCluster_ManagedMasterPassword_managedSpecificKMSKey
    cluster_test.go:1711: Step 1/2 error: Error running apply: exit status 1

        Error: creating RDS Cluster (tf-acc-test-8808943976642895551): InvalidParameterCombination: The Parameter Group default.aurora-mysql5.7 with DBParameterGroupFamily aurora-mysql5.7 cannot be used for this instance. Please use a Parameter Group with DBParameterGroupFamily aurora-mysql8.0
                status code: 400, request id: ab8f3745-d0de-45d0-813d-5fa767b66cc3

          with aws_rds_cluster.test,
          on terraform_plugin_test.tf line 28, in resource "aws_rds_cluster" "test":
          28: resource "aws_rds_cluster" "test" {

--- FAIL: TestAccRDSCluster_ManagedMasterPassword_managedSpecificKMSKey (84.88s)
=== CONT  TestAccRDSCluster_SnapshotIdentifier_masterPassword
--- PASS: TestAccRDSInstance_manage_password (740.09s)
=== CONT  TestAccRDSInstanceDataSource_tags
--- PASS: TestAccRDSInstanceDataSource_basic (941.80s)
=== CONT  TestAccRDSCluster_basic
    cluster_test.go:46: Step 1/2 error: Error running apply: exit status 1

        Error: creating RDS Cluster (tf-acc-test-9143105111000657070): InvalidParameterCombination: The Parameter Group default.aurora-mysql5.7 with DBParameterGroupFamily aurora-mysql5.7 cannot be used for this instance. Please use a Parameter Group with DBParameterGroupFamily aurora-mysql8.0
                status code: 400, request id: 6d3c20b9-bdad-448b-8823-8091f0a0bbb5

          with aws_rds_cluster.test,
          on terraform_plugin_test.tf line 2, in resource "aws_rds_cluster" "test":
           2: resource "aws_rds_cluster" "test" {

--- FAIL: TestAccRDSCluster_basic (23.67s)
=== CONT  TestAccRDSClusterDataSource_ManagedMasterPassword_managed
--- PASS: TestAccRDSCluster_SnapshotIdentifier_masterPassword (533.13s)
=== NAME  TestAccRDSClusterDataSource_ManagedMasterPassword_managed
    cluster_data_source_test.go:57: Step 1/1 error: Error running pre-apply refresh: exit status 1

        Error: Missing required argument

          on terraform_plugin_test.tf line 37, in resource "aws_rds_cluster" "test":
          37: resource "aws_rds_cluster" "test" {

        The argument "engine" is required, but no definition was found.
--- FAIL: TestAccRDSClusterDataSource_ManagedMasterPassword_managed (12.89s)
--- PASS: TestAccRDSInstanceDataSource_tags (924.32s)
FAIL
FAIL    github.com/hashicorp/terraform-provider-aws/internal/service/rds        3169.429s
FAIL
make: *** [testacc] Error 1

@AdamTylerLynch AdamTylerLynch removed the needs-triage Waiting for first response or review from a maintainer. label Oct 17, 2023
@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 Oct 17, 2023
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=TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKMSKey\|TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword\|TestAccRDSInstance_basic' PKG=rds ACCTEST_PARALLELISM=2
==> Checking that code complies with gofmt requirements...
TF_ACC=1 go test ./internal/service/rds/... -v -count 1 -parallel 2  -run=TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKMSKey\|TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword\|TestAccRDSInstance_basic -timeout 360m
=== RUN   TestAccRDSInstance_basic
=== PAUSE TestAccRDSInstance_basic
=== RUN   TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKMSKey
=== PAUSE TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKMSKey
=== RUN   TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword
=== PAUSE TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword
=== CONT  TestAccRDSInstance_basic
=== CONT  TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword
--- PASS: TestAccRDSInstance_basic (543.41s)
=== CONT  TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKMSKey
--- PASS: TestAccRDSInstance_RestoreToPointInTime_ManagedMasterPassword (1340.34s)
--- PASS: TestAccRDSInstance_SnapshotIdentifier_ManagedMasterPasswordKMSKey (1415.64s)
PASS
ok  	github.com/hashicorp/terraform-provider-aws/internal/service/rds	1964.776s

@ewbankkit
Copy link
Contributor

@gchristidis Thanks for the contribution 🎉 👏.

@ewbankkit ewbankkit merged commit 8992c9d into hashicorp:main Oct 18, 2023
34 checks passed
@github-actions github-actions bot added this to the v5.22.0 milestone Oct 18, 2023
@gchristidis gchristidis deleted the b-aws_db_instance-managemaster branch October 19, 2023 02:22
@github-actions
Copy link

This functionality has been released in v5.22.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 Nov 20, 2023
@justinretzolk justinretzolk added the bug Addresses a defect in current functionality. label Feb 10, 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. prioritized Part of the maintainer teams immediate focus. To be addressed within the current quarter. service/rds Issues and PRs that pertain to the rds service. size/L 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.

[Bug]: Cannot use manage master password in Secrets Manager when creating RDS from snapshot
4 participants