terraform-aws-rds
terraform-aws-rds copied to clipboard
Upgrade from v3.5 to v4+ forces deletion of module.db.module.db_subnet_group.aws_db_subnet_group.this[0]
Description
Once we try to upgrade AWS RDS Terraform module version from 3.5 to any 4+ version (5.3.0 included) we see in the following in terraform plan:
# module.db.module.db_subnet_group.aws_db_subnet_group.this[0] will be destroyed
# (because index [0] is out of range for count)
- resource "aws_db_subnet_group" "this" {
<output omitted>
}
I suppose the problem is with modules/db/modules/db_subnet_group/main.tf
count = var.create ? 1 : 0
Workaround
set create_db_subnet_group option to true, which is not clear, as it is already exists and this option is not mandatory required, according to the documentation
Versions
-
Module version [Required]: AWS RDS Terraform module 5.3.0
-
Terraform version: Terraform v1.1.5
-
Provider version(s): AWS 4.30.0