I have some Terraform code that creates an AWS Aurora RDS cluster:
resource "aws_rds_cluster" "default" {
provider = aws.customer
cluster_identifier = "my_id"
engine = "aurora-mysql"
engine_version = "5.7.mysql_aurora.2.03.2"
database_name = var.db_name
port = var.db_port
master_username = var.db_master_username
master_password = random_password.sqlpassword.result
backup_retention_period = 5
preferred_backup_window = "07:00-09:00"
skip_final_snapshot = true
db_subnet_group_name = aws_db_subnet_group.default.name
vpc_security_group_ids = [aws_security_group.rds.id]
deletion_protection = true
}
This code has been working fine for quite a while until just recently when terraform apply fails with this error Error: Failed to modify RDS Cluster (my_id): InvalidParameterCombination: Cannot upgrade aurora-mysql from 5.7.mysql_aurora.2.07.2 to 5.7.mysql_aurora.2.03.2
To make a long story short, AWS upgraded the minor version number in a maintenance window and refuses to allow Terraform to downgrade the database. I'm fine with AWS doing this, but I don't want to have to commit new Terraform code every time this happens.
I tried being less specific in the engine version by using engine_version="5.7.mysql_aurora.2", but that failed like this: InvalidParameterCombination: Cannot find upgrade target from 5.7.mysql_aurora.2.07.2 with requested version 5.7.mysql_aurora.2.
What would be the appropriate Terraform method to allow the RDS Minor Version to float with modifications performed by AWS?