hashicorp / terraform-provider-aws

The AWS Provider enables Terraform to manage AWS resources.
https://registry.terraform.io/providers/hashicorp/aws
Mozilla Public License 2.0
9.87k stars 9.21k forks source link

[Bug]: Changing identifier in RDS Cluster and Cluster Instance (aws_rds_cluster & aws_rds_cluster_instance) forces recreate #38644

Open DemonICOLI opened 4 months ago

DemonICOLI commented 4 months ago

Terraform Core Version

1.9

AWS Provider Version

5.0

Affected Resource(s)

Expected Behavior

Neither of those resources should be force recreated as this change can be done no issues on AWS Console... this also seem to affect normal instances at some point, but fix was not propagated to cluster, https://github.com/hashicorp/terraform-provider-aws/issues/507

Actual Behavior

Cluster and Cluster instances will have their identifiers updated without recreation

Relevant Error/Panic Output Snippet

No response

Terraform Configuration Files


resource "aws_rds_cluster" "postgresql" {
  cluster_identifier      = "aurora-cluster-demo" <--- CHANGE THIS
  engine                  = "aurora-postgresql"
  availability_zones      = ["us-west-2a", "us-west-2b", "us-west-2c"]
  database_name           = "mydb"
  master_username         = "foo"
  master_password         = "must_be_eight_characters"
  backup_retention_period = 5
  preferred_backup_window = "07:00-09:00"
}

Steps to Reproduce

Create an aurora cluster and cluster instance try to rename them by use the identifier property

Debug Output

No response

Panic Output

No response

Important Factoids

No response

References

No response

Would you like to implement a fix?

None

github-actions[bot] commented 4 months ago

Community Note

Voting for Prioritization

Volunteering to Work on This Issue

AnthonyGarriga commented 3 months ago

I'm having the same issue. I simply want to change the identifier on the cluster and cluster instance and Terraform forces a recreate, which removes all data from the cluster. Is there any workaround?

aviau commented 3 months ago

Same issue here. It looks like workaround is to delete the resource from the state and re-import it...

AnthonyGarriga commented 3 months ago

Same issue here. It looks like workaround is to delete the resource from the state and re-import it...

Yes, I ended up removing the resources from the state, renaming the RDS cluster and cluster instance in the AWS console, and then re-importing them to the state. It works for now but it's a workaround.

justinretzolk commented 3 months ago

Similar #34935 Related #38599