In a tvfars file I have this:
locals {
common = {
"my key" = "value"
}
}
because I want to use the map in multiple places in that file. I read the terraform docs about variables and I cannot find the correct syntax. I tried the following (var1 and 2 are both declared as maps):
With
var1 = "${local.common}" var2 = "${local.common}"I get
variable "var1" should be type map, got stringWith
var1 = locals.common var2 = locals.commonI get
invalid value "myfile.auto.tfvars" for flag -var-file-default: Error parsing myfile.auto.tfvars: At 18:15: Unknown token: 18:15 IDENT locals.commonWith
var1 = {"${local.common}"} var2 = {"${local.common}"}which fails without an error message but a print of terraform help and terraform exits.
I verified that everything works fine if I copy/paste the map multiple times:
var1 = {
"my key" = "value"
}
var2 = {
"my key" = "value"
}
Anyone know correct syntax?