0.12.24
aws_rds_cluster
When creating an RDS cluster with engine_mode = "global" (and with a global_cluster_identifier), the cluster should be created and added to the specified global RDS cluster. When running terraform apply again, there should be no changes found.
For Aurora MySQL version 5.7.mysql_aurora.2.07.0 and above, the DescribeDBClusters API endpoint returns engine_mode = "provisioned" for global clusters, instead of the expected engine_mode = "global". This causes Terraform to think that the engine mode has changed and that the cluster must be replaced when terraform apply is re-run. I confirmed this behaviour with AWS Support, and they said that this is intentional (and they will be updating the documentation to note this in the future).
They stated that the proper way to determine if a DB cluster is part of a global cluster is to call the DescribeGlobalClusters endpoint to see if the cluster in question is listed as a member of a global cluster.
This is a relatively easy fix: around this line, the provider needs to call the rdsDescribeGlobalClusterFromDbClusterARN function for all DB clusters, not just the ones with engine_mode = "global".
5.7.mysql_aurora.2.07.0)terraform applyterraform apply again and note that it tries to replace the cluster.We're running into this as well. The experience is that after a fresh creation of a global MySQL 5.7 RDS Aurora cluster and associated resources, a fresh plan returns these changes rather than being a no-op:
aws_rds_cluster tries to add the global_cluster_identifier attribute:~ resource "aws_rds_cluster" "primary" {
arn = "arn:aws:rds:us-east-1:0000000000:cluster:foo-us-east-1"
...
cluster_identifier = "foo-us-east-1"
cluster_resource_id = "cluster-foo"
engine = "aurora-mysql"
engine_mode = "provisioned"
engine_version = "5.7.mysql_aurora.2.07.1"
+ global_cluster_identifier = "foo"
...
}
aws_rds_cluster tries to add the global_cluster_identifier attribute and unset the replication_source_identifier attribute:~ resource "aws_rds_cluster" "secondary" {
arn = "arn:aws:rds:us-west-1:0000000000:cluster:foo-us-west-1"
...
cluster_identifier = "foo-us-west-1"
cluster_resource_id = "cluster-foo"
engine = "aurora-mysql"
engine_mode = "provisioned"
engine_version = "5.7.mysql_aurora.2.07.1"
+ global_cluster_identifier = "foo"
...
- replication_source_identifier = "arn:aws:rds:us-east-1:0000000000:cluster:foo-us-east-1" -> null
}
An apply of these changes fails with:
Error: Existing RDS Clusters cannot be added to an existing RDS Global Cluster
It seems RDS is responding with the correct fields, its just that the terraform provider isnt populating them due to the inaccurate logic mentioned above.
I agree with the proposal to update the logic for deciding whether to rdsDescribeGlobalClusterFromDbClusterARN
The fix for this has been merged and will release with version 2.59.0 of the Terraform AWS Provider, later today. 👍
This has been released in version 2.59.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!
Most helpful comment
We're running into this as well. The experience is that after a fresh creation of a global MySQL 5.7 RDS Aurora cluster and associated resources, a fresh plan returns these changes rather than being a no-op:
aws_rds_clustertries to add theglobal_cluster_identifierattribute:aws_rds_clustertries to add theglobal_cluster_identifierattribute and unset thereplication_source_identifierattribute:An apply of these changes fails with:
It seems RDS is responding with the correct fields, its just that the terraform provider isnt populating them due to the inaccurate logic mentioned above.
I agree with the proposal to update the logic for deciding whether to
rdsDescribeGlobalClusterFromDbClusterARN