-
Notifications
You must be signed in to change notification settings - Fork 9.2k
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
ERROR when creating an Aurora RDS global cluster and snapshot_identifier is defined #10965
Comments
Hi, anything I can help for someone to take a look at this ? |
Maybe @bflad since he did last commit on RDS resources. |
Hi folks 👋 My focus is elsewhere at the moment, but in brief searching around this topic:
This represents a little bit of a problem in Terraform though as it'll introduce a circular reference (to do it properly): # Potential implementation
# The source_db_cluster_identifier argument does not currently exist
resource "aws_rds_global_cluster" "example" {
# ... other configuration ...
source_db_cluster_identifier = aws_rds_cluster.example.id
}
resource "aws_rds_cluster" "example" {
snapshot_identifier = aws_db_cluster_snapshot.example.id
# NOTE: Due to restoring this Cluster from Cluster Snapshot
# and using this Cluster to create a Global Cluster, the
# global_cluster_identifier attribute will become populated and
# Terraform will begin showing it as a difference. We cannot do:
# global_cluster_identifier = aws_rds_global_cluster.example.id
# as it introduces a circular reference. As a potential workaround:
lifecycle {
ignore_changes = [global_cluster_identifier]
}
} This workaround would need to be documented to reduce potential confusion around the subject. Another option would be to mark the
Hope this helps. EDIT: Please note that this is marked as an enhancement since this is a feature request to support the |
Thanks @bflad, I have another question, how this will work with multiple secondary clusters? |
Hi @marinsalinas 👋 I'm not sure I understand the question, could you elaborate? |
Hey, @bflad, I can provide more explanation on this: Since the potential implementation is: # Potential implementation
# The source_db_cluster_identifier argument does not currently exist
resource "aws_rds_global_cluster" "example" {
# ... other configuration ...
source_db_cluster_identifier = aws_rds_cluster.example.id
}
resource "aws_rds_cluster" "example" {
snapshot_identifier = aws_db_cluster_snapshot.example.id
# NOTE: Due to restoring this Cluster from Cluster Snapshot
# and using this Cluster to create a Global Cluster, the
# global_cluster_identifier attribute will become populated and
# Terraform will begin showing it as a difference. We cannot do:
# global_cluster_identifier = aws_rds_global_cluster.example.id
# as it introduces a circular reference. As a potential workaround:
lifecycle {
ignore_changes = [global_cluster_identifier]
}
} How will we add secondary clusters into the configuration? I'm thinking something like: # Potential implementation
# The source_db_cluster_identifier argument does not currently exist
resource "aws_rds_global_cluster" "example" {
# ... other configuration ...
source_db_cluster_identifier = aws_rds_cluster.example.id
}
resource "aws_rds_cluster" "example" {
snapshot_identifier = aws_db_cluster_snapshot.example.id
# NOTE: Due to restoring this Cluster from Cluster Snapshot
# and using this Cluster to create a Global Cluster, the
# global_cluster_identifier attribute will become populated and
# Terraform will begin showing it as a difference. We cannot do:
# global_cluster_identifier = aws_rds_global_cluster.example.id
# as it introduces a circular reference. As a potential workaround:
lifecycle {
ignore_changes = [global_cluster_identifier]
}
}
provider "aws" {
region = "us-west-2"
alas = "uw2"
}
//My point of view and how to add secondary clusters.
resource "aws_rds_cluster" "secondary" {
provider = aws.uw2
global_cluster_identifier = aws_rds_global_cluster.example.id
depends_on = [aws_rds_cluster.example]
} is that correct? |
@marinsalinas that would be the expected configuration, potentially without the |
I have the exact same problem. When i create a global cluster from scratch everythings works but this is not what i need to do. I have an existing DB which need to be replicated in another region. I see at least 2 ways:
First way is what AWS Console do via 'add region'. I think @bflad has pointed the main problem : Terraform AWS provider actually miss SourceDBClusterIdentifier parameter to connect the global cluster with an existing cluster. |
@bflad Hello , I am facing a similar issue when trying to attach the existing RDS cluster to the Global cluster. terraform errors out as follow. AWS does offer API/CLI/SDK ways to attach and existing regional cluster to Global while creating the Global with "--source-db-cluster-identifier". It would be great if terraform can release this enhancement/bug to support attaching existing DB regional clusters to Global. |
Enhancement submitted: #14487 |
…ter_identifier arguments, add global_cluster_members attribute Reference: #10965 Output from acceptance testing: ``` --- PASS: TestAccAWSRdsGlobalCluster_disappears (11.01s) --- PASS: TestAccAWSRdsGlobalCluster_Engine_Aurora (14.06s) --- PASS: TestAccAWSRdsGlobalCluster_EngineVersion_AuroraPostgresql (14.18s) --- PASS: TestAccAWSRdsGlobalCluster_basic (14.27s) --- PASS: TestAccAWSRdsGlobalCluster_EngineVersion_AuroraMySQL (14.55s) --- PASS: TestAccAWSRdsGlobalCluster_EngineVersion_Aurora (14.72s) --- PASS: TestAccAWSRdsGlobalCluster_DeletionProtection (21.99s) --- PASS: TestAccAWSRdsGlobalCluster_DatabaseName (23.70s) --- PASS: TestAccAWSRdsGlobalCluster_StorageEncrypted (25.16s) --- PASS: TestAccAWSRdsGlobalCluster_SourceDbClusterIdentifier (168.11s) ```
…ter_identifier arguments, add global_cluster_members attribute (#14487) Reference: #10965 Output from acceptance testing: ``` --- PASS: TestAccAWSRdsGlobalCluster_disappears (11.01s) --- PASS: TestAccAWSRdsGlobalCluster_Engine_Aurora (14.06s) --- PASS: TestAccAWSRdsGlobalCluster_EngineVersion_AuroraPostgresql (14.18s) --- PASS: TestAccAWSRdsGlobalCluster_basic (14.27s) --- PASS: TestAccAWSRdsGlobalCluster_EngineVersion_AuroraMySQL (14.55s) --- PASS: TestAccAWSRdsGlobalCluster_EngineVersion_Aurora (14.72s) --- PASS: TestAccAWSRdsGlobalCluster_DeletionProtection (21.99s) --- PASS: TestAccAWSRdsGlobalCluster_DatabaseName (23.70s) --- PASS: TestAccAWSRdsGlobalCluster_StorageEncrypted (25.16s) --- PASS: TestAccAWSRdsGlobalCluster_SourceDbClusterIdentifier (168.11s) ```
Hi folks 👋 Support for new |
This has been released in version 3.1.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 for triage. Thanks! |
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! |
Hi.
I have been working with terraform to create RDS global cluster without many issues until now.
I'm using the same code I use to create my prod global cluster to create another cluster base on the original prod cluster snapshot but when
snapshot_identifier
is provided the cluster gets created as a regional cluster and it is not attached to the newly created global cluster BUT if I use exactly the same code without specifing thesnapshot_identifier
the global cluster is created and the newregional
rds cluster gets atached inmediatly to the global cluster.Exactly the sam behavior happens when using the console but in the console I can successfully create the global cluster from the snapshot.
Keep in mind that I replaced some text to hide personal information
the sample code :
Plan output :
Version :
terraform_0.12.16
provider "local" (hashicorp/local) 1.4.0
provider "aws" (hashicorp/aws) 2.38.0...
provider "null" (hashicorp/null) 2.1.2...
provider "template" (hashicorp/template) 2.1.2
provider "mysql" (terraform-providers/mysql) 1.9.0
provider "random" (hashicorp/random) 2.2.1
Expected Behavior
new global cluster should be created and a new rds cluster should have been attached to the global cluster after being created from the snapshot.
Actual Behavior
A global cluster is created and a standalone RDS cluster is created from the snapshot but the RDS cluster is not attached to the Global cluster
When created without using
snapshot_identifier
the global cluster an RDS clusters are created correctly.the error when trying to re-
apply
the terraform is :Error: Existing RDS Clusters cannot be added to an existing RDS Global Cluster
The text was updated successfully, but these errors were encountered: