terraform-aws-rds-cluster icon indicating copy to clipboard operation
terraform-aws-rds-cluster copied to clipboard

Second destroy will fail if snapshot is not skipped due to snapshot conflict

Open nitrocode opened this issue 3 years ago • 1 comments

Found a bug? Maybe our Slack Community can help.

Slack Community

Describe the Bug

If the cluster is created and destroyed and then created again and attempted a destroy again, the last destroy will fail because there is a snapshot with the same name as the last one.

│ Error: error deleting RDS Cluster (aurora-example-shared): DBClusterSnapshotAlreadyExistsFault: Cannot create the cluster snapshot because one with the identifier aurora-example-shared already exists.

Expected Behavior

Add a random id to the final snapshot when the cluster is created to avoid conflicts

nitrocode avatar Dec 28 '21 23:12 nitrocode

Can we get this resolved? It would be good to give control of this value.

  final_snapshot_identifier           = var.cluster_identifier == "" ? lower(module.this.id) : lower(var.cluster_identifier)

maybe with...

  final_snapshot_identifier           = coalesce(var.final_snapshot_identifier, var.cluster_identifier == "" ? lower(module.this.id) : lower(var.cluster_identifier))

...

variable "final_snapshot_identifier" {
  default = ""
}

johncblandii avatar Dec 11 '23 17:12 johncblandii