Hi,
I have a use case where I want to make a change in an existing environment that “forces replacement” on an RDS Aurora DB cluster “aws_rds_cluster”.
I don’t really want to lose the data in that cluster and I was wondering if there was anyway I could code this so that the final snapshot is taken when the cluster is destroyed and is then used when the replacement is created.
So something like this…
resource "aws_rds_cluster" "cpf_db_cluster" {
cluster_identifier = format("%s-db-cluster", var.environment)
availability_zones = slice(data.aws_availability_zones.available.names, 0, local.number_of_azs)
...
final_snapshot_identifier = "db-final-snapshot"
snapshot_identifier = <ifreplacingdb>?"db-final-snapshot":null
...
}
The replacement causing change I’m making here is changing the availability zones that are being used by the database.
Any ideas how I might do this, is it possible? Of course I can do it manually but it is fiddly and error prone.
thanks