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

resource/aws_rds_cluster: Prevent InvalidParameterCombination error with engine_version and snapshot_identifier on creation #6391

Merged
merged 2 commits into from
Nov 8, 2018

Conversation

bflad
Copy link
Contributor

@bflad bflad commented Nov 7, 2018

Fixes #6157

This is a similar refactoring to the aws_db_instance resource that has occurred recently over a few iterations. The refactoring prevents a class of potential bugs related to unexpected update errors or an extraneous update after restoring from snapshot or S3. Instead we should be left with "requires two applies" type issues, which are more workable.

Changes:

  • resource/aws_rds_cluster: Refactor Create function to call ModifyDBCluster directly instead of Update function

Output from acceptance testing:

--- PASS: TestAccAWSRDSCluster_BacktrackWindow (177.25s)
--- PASS: TestAccAWSRDSCluster_backupsUpdate (194.40s)
--- PASS: TestAccAWSRDSCluster_basic (123.91s)
--- PASS: TestAccAWSRDSCluster_DeletionProtection (195.88s)
--- PASS: TestAccAWSRDSCluster_encrypted (124.72s)
--- PASS: TestAccAWSRDSCluster_EncryptedCrossRegionReplication (1578.13s)
--- PASS: TestAccAWSRDSCluster_EngineMode (378.92s)
--- PASS: TestAccAWSRDSCluster_EngineMode_ParallelQuery (128.98s)
--- PASS: TestAccAWSRDSCluster_EngineVersion (137.07s)
--- PASS: TestAccAWSRDSCluster_EngineVersionWithPrimaryInstance (1117.06s)
--- PASS: TestAccAWSRDSCluster_generatedName (145.47s)
--- PASS: TestAccAWSRDSCluster_iamAuth (156.83s)
--- PASS: TestAccAWSRDSCluster_importBasic (128.64s)
--- PASS: TestAccAWSRDSCluster_kmsKey (143.46s)
--- PASS: TestAccAWSRDSCluster_missingUserNameCausesError (2.34s)
--- PASS: TestAccAWSRDSCluster_namePrefix (123.69s)
--- PASS: TestAccAWSRDSCluster_Port (297.06s)
--- PASS: TestAccAWSRDSCluster_s3Restore (1391.94s)
--- PASS: TestAccAWSRDSCluster_ScalingConfiguration (281.57s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier (364.76s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_DeletionProtection (490.59s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EncryptedRestore (426.54s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_ParallelQuery (366.46s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_Provisioned (355.81s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Different (386.44s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Equal (407.85s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredBackupWindow (355.70s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredMaintenanceWindow (386.74s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_Tags (364.61s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds (362.35s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds_Tags (463.75s)
--- PASS: TestAccAWSRDSCluster_takeFinalSnapshot (186.68s)
--- PASS: TestAccAWSRDSCluster_updateCloudwatchLogsExports (163.99s)
--- PASS: TestAccAWSRDSCluster_updateIamRoles (143.56s)
--- PASS: TestAccAWSRDSCluster_updateTags (163.35s)

… with `engine_version` and `snapshot_identifier` on creation

This is a similar refactoring to the `aws_db_instance` resource that has occurred recently over a few iterations. The refactoring prevents a class of potential bugs related to unexpected update errors or an extraneous update after restoring from snapshot or S3. Instead we should be left with "requires two applies" type issues, which are more workable.

Changes:
* resource/aws_rds_cluster: Refactor Create function to call ModifyDBCluster directly instead of Update function

Output from acceptance testing:

```
--- PASS: TestAccAWSRDSCluster_BacktrackWindow (177.25s)
--- PASS: TestAccAWSRDSCluster_backupsUpdate (194.40s)
--- PASS: TestAccAWSRDSCluster_basic (123.91s)
--- PASS: TestAccAWSRDSCluster_DeletionProtection (195.88s)
--- PASS: TestAccAWSRDSCluster_encrypted (124.72s)
--- PASS: TestAccAWSRDSCluster_EncryptedCrossRegionReplication (1578.13s)
--- PASS: TestAccAWSRDSCluster_EngineMode (378.92s)
--- PASS: TestAccAWSRDSCluster_EngineMode_ParallelQuery (128.98s)
--- PASS: TestAccAWSRDSCluster_EngineVersion (137.07s)
--- PASS: TestAccAWSRDSCluster_EngineVersionWithPrimaryInstance (1117.06s)
--- PASS: TestAccAWSRDSCluster_generatedName (145.47s)
--- PASS: TestAccAWSRDSCluster_iamAuth (156.83s)
--- PASS: TestAccAWSRDSCluster_importBasic (128.64s)
--- PASS: TestAccAWSRDSCluster_kmsKey (143.46s)
--- PASS: TestAccAWSRDSCluster_missingUserNameCausesError (2.34s)
--- PASS: TestAccAWSRDSCluster_namePrefix (123.69s)
--- PASS: TestAccAWSRDSCluster_Port (297.06s)
--- PASS: TestAccAWSRDSCluster_s3Restore (1391.94s)
--- PASS: TestAccAWSRDSCluster_ScalingConfiguration (281.57s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier (364.76s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_DeletionProtection (490.59s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EncryptedRestore (426.54s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_ParallelQuery (366.46s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_Provisioned (355.81s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Different (386.44s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Equal (407.85s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredBackupWindow (355.70s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredMaintenanceWindow (386.74s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_Tags (364.61s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds (362.35s)
--- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds_Tags (463.75s)
--- PASS: TestAccAWSRDSCluster_takeFinalSnapshot (186.68s)
--- PASS: TestAccAWSRDSCluster_updateCloudwatchLogsExports (163.99s)
--- PASS: TestAccAWSRDSCluster_updateIamRoles (143.56s)
--- PASS: TestAccAWSRDSCluster_updateTags (163.35s)
```
@bflad bflad added bug Addresses a defect in current functionality. service/rds Issues and PRs that pertain to the rds service. labels Nov 7, 2018
@bflad bflad requested a review from a team November 7, 2018 18:58
@ghost ghost added size/XL Managed by automation to categorize the size of a PR. tests PRs: expanded test coverage. Issues: expanded coverage, enhancements to test infrastructure. labels Nov 7, 2018
@bflad bflad mentioned this pull request Nov 7, 2018
Copy link
Contributor

@tombuildsstuff tombuildsstuff left a comment

Choose a reason for hiding this comment

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

LGTM 👍

clusterUpdate = true
if attr := d.Get("vpc_security_group_ids").(*schema.Set); attr.Len() > 0 {
opts.VpcSecurityGroupIds = expandStringList(attr.List())
// requiresModifyDbCluster = true
Copy link
Contributor

Choose a reason for hiding this comment

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

is this intentionally commented out?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great catch! For some reason the old code had it (so it was being set both during create and calling an update) and I was experimenting 🔬 -- experiment was a success! I'll remove it. 👍

@bflad bflad added this to the v1.43.1 milestone Nov 8, 2018
@bflad bflad merged commit 0d170aa into master Nov 8, 2018
@bflad bflad deleted the b-aws_rds_cluster-snapshot-version branch November 8, 2018 13:42
bflad added a commit that referenced this pull request Nov 8, 2018
@bflad
Copy link
Contributor Author

bflad commented Nov 9, 2018

This has been released in version 1.43.1 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading.

@ghost
Copy link

ghost commented Apr 2, 2020

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. Thanks!

@ghost ghost locked and limited conversation to collaborators Apr 2, 2020
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/rds Issues and PRs that pertain to the rds service. size/XL 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 version 1.40
2 participants