-
Notifications
You must be signed in to change notification settings - Fork 9.1k
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
service/rds: Initial support for RDS Aurora Global Databases #6861
Conversation
Changes: * resource/aws_rds_cluster: Add `global_cluster_identifier` argument * resource/aws_rds_cluster: Allow `global` in `engine_mode` validation * resource/aws_rds_cluster: Automatically remove cluster from global cluster on delete * New Resource: `aws_rds_global_cluster` ``` --- PASS: TestAccAWSRDSCluster_BacktrackWindow (185.53s) --- PASS: TestAccAWSRDSCluster_backupsUpdate (206.64s) --- PASS: TestAccAWSRDSCluster_basic (135.45s) --- PASS: TestAccAWSRDSCluster_DeletionProtection (165.47s) --- PASS: TestAccAWSRDSCluster_encrypted (126.42s) --- PASS: TestAccAWSRDSCluster_EncryptedCrossRegionReplication (1609.46s) --- PASS: TestAccAWSRDSCluster_EngineMode (344.98s) --- PASS: TestAccAWSRDSCluster_EngineMode_Global (118.41s) --- PASS: TestAccAWSRDSCluster_EngineMode_ParallelQuery (117.81s) --- PASS: TestAccAWSRDSCluster_EngineVersion (122.85s) --- PASS: TestAccAWSRDSCluster_EngineVersionWithPrimaryInstance (1022.02s) --- PASS: TestAccAWSRDSCluster_generatedName (176.05s) --- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier (125.53s) --- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_Add (132.58s) --- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_Remove (140.14s) --- PASS: TestAccAWSRDSCluster_GlobalClusterIdentifier_Update (124.50s) --- PASS: TestAccAWSRDSCluster_iamAuth (115.26s) --- PASS: TestAccAWSRDSCluster_importBasic (116.22s) --- PASS: TestAccAWSRDSCluster_kmsKey (144.50s) --- PASS: TestAccAWSRDSCluster_missingUserNameCausesError (2.31s) --- PASS: TestAccAWSRDSCluster_namePrefix (145.07s) --- PASS: TestAccAWSRDSCluster_Port (252.80s) --- PASS: TestAccAWSRDSCluster_s3Restore (1474.31s) --- PASS: TestAccAWSRDSCluster_ScalingConfiguration (270.01s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier (438.26s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_DeletionProtection (374.71s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EncryptedRestore (331.91s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_ParallelQuery (353.25s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineMode_Provisioned (355.21s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Different (358.34s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_EngineVersion_Equal (394.42s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredBackupWindow (380.13s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_PreferredMaintenanceWindow (334.25s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_Tags (354.72s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds (255.20s) --- PASS: TestAccAWSRDSCluster_SnapshotIdentifier_VpcSecurityGroupIds_Tags (271.42s) --- PASS: TestAccAWSRDSCluster_takeFinalSnapshot (93.01s) --- PASS: TestAccAWSRDSCluster_updateCloudwatchLogsExports (158.10s) --- PASS: TestAccAWSRDSCluster_updateIamRoles (122.85s) --- PASS: TestAccAWSRDSCluster_updateTags (153.91s) --- PASS: TestAccAWSRdsGlobalCluster_basic (14.24s) --- PASS: TestAccAWSRdsGlobalCluster_DatabaseName (24.06s) --- PASS: TestAccAWSRdsGlobalCluster_DeletionProtection (22.31s) --- PASS: TestAccAWSRdsGlobalCluster_disappears (11.16s) --- PASS: TestAccAWSRdsGlobalCluster_Engine_Aurora (14.41s) --- PASS: TestAccAWSRdsGlobalCluster_EngineVersion_Aurora (14.24s) --- PASS: TestAccAWSRdsGlobalCluster_StorageEncrypted (25.60s) ```
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 with some minor comments
// Automatically remove from global cluster to bypass this error on deletion: | ||
// InvalidDBClusterStateFault: This cluster is a part of a global cluster, please remove it from globalcluster first | ||
if d.Get("global_cluster_identifier").(string) != "" { | ||
input := &rds.RemoveFromGlobalClusterInput{ |
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.
Since this same chunk of code is used in update, I'd suggest having it in it's own function
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.
The error handling is slightly different. 😄 I'm not sure if the indirection is worthwhile to fill in a two value struct, print a log line, and call the API, but we can certainly discuss this out of band! 👍
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.
That's good with me!
Type: schema.TypeString, | ||
Computed: true, | ||
}, | ||
"source_db_cluster_identifier": { |
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.
I don't see this being used anywhere. Should we remove it or was it missed?
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.
Good find and probably something I should've mentioned in the commit message/PR comment!
The RDS API gives you this second option for creating Global Clusters, based on an existing Cluster with global engine mode, instead of creating an "empty" Global Cluster. I think there were two reasons for omitting this to start.
When playing with this, the workflow wound up being very tedious because of operation ordering requirements within the RDS API and Terraform references. If I recall correctly, since the Cluster becomes a child of the Global Cluster in the dependency graph and Global Clusters, it wasn't easy to setup the resources to properly destroy. I may have inadvertently fixed this issue with the aws_rds_cluster
resource Delete
function update though. 😅
The other workflow issue is that engine mode cannot be currently updated for existing Clusters, so essentially you have to create new Clusters anyways to get Global Cluster support. I didn't think we needed to introduce all the complexity of supporting both creation methods initially, since operators can just adjust their initial Global Cluster configuration to match our supported workflow. I may have missed something in my thinking there though.
TL;DR I'll remove this attribute for now since its not used. If there are use cases that require it, we can add it (and all its complexity) later. 👍
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.
Now that I'm thinking about it more -- it was that because of the referencing (Global Cluster being dependent on Cluster), we'd try to destroy the Global Cluster first and it would complain that it still had members. We'd have to introduce a flag in aws_rds_global_cluster
to allow you to force remove all members first. Not unsurmountable, but definitely additional complexity which we might not need.
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.
Ouch, that extra flag seems tricky but I'm totally onboard with seeing this come in later if it's requested.
Co-Authored-By: bflad <bflad417@gmail.com>
…e_db_cluster_identifier attribute
TravisCI is green and re-verified the acceptance testing around the adjusted conditional, merging!
|
This has been released in version 1.53.0 of the AWS provider. Please see the Terraform documentation on provider versioning or reach out if you need any assistance upgrading. |
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! |
Closes #6846
Changes:
global
inengine_mode
validationglobal_cluster_identifier
argumentaws_rds_global_cluster