I'm trying to upgrade my TF 0.11 code to 0.12 and i stuck with a variable issue.
In TF 0.11 this blocked worked as expected in the variables.tf file
variable "postgres_dbs" {
type = "map"
default = {
postgres1 = {
name_postfix = "postgres",
enable = true,
sku = "MO_Gen5_16",
capacity = "16"
}
postgres2 = {
name_postfix = "postgres-2",
enable = false,
sku = "MO_Gen5_16",
capacity = "16"
}
postgres3 = {
name_postfix = "postgres-3",
enable = false,
sku = "MO_Gen5_16",
capacity = "16"
}
postgres4 = {
name_postfix = "postgres-4",
enable = false,
sku = "MO_Gen5_16",
capacity = "16"
}
postgres5 = {
name_postfix = "postgres-5",
enable = false,
sku = "MO_Gen5_16",
capacity = "16"
}
postgres6 = {
name_postfix = "postgres-6",
enable = false,
sku = "MO_Gen5_16",
capacity = "16"
}
postgres7 = {
name_postfix = "postgres-7",
enable = false,
sku = "MO_Gen5_16",
capacity = "16"
}
postgres8 = {
name_postfix = "postgres-8",
enable = false,
sku = "MO_Gen5_16",
capacity = "16"
}
}
}
After running the terraform 012upgrade command ( It finished with no errors ) TF changed the block to use
variable "postgres_dbs" {
type = map(string)
But the error when running terraform validate is :
This default value is not compatible with the variable's type constraint:
element "postgres6": string required.
Any advice ? Thanks!