Hi All,
I am trying to pass variable list(object({}) type with the below values.
##Variables.tf
variable “filter” {
type = list(object({
name = string
desc= string
filter = string
}))
description = "filter
}
#tfvars
filter = #{filter}# —> Replacing the values using tokens replacer with Variable group values in Azure Devops.
azure variable group.
filter = [
{
name = “test1”
description = “test1”
filter = <<EOT
“Multiline string”
EOT
},
{
name = “test2”
desc = “test2”
filter = <<EOT
“multi line string”
EOT
}
]
Upon saving this data in variable group. It is formatted like below
[ { name = “test1” desc = “test1” filter = <<EOT “multiline” EOT }, { name = “test2” desc = “test2” filter = <<EOT “multiline” EOT } ]
This works when the tfvars are hardcoded with the values used in filter. but, on doing the token replacement in pipelines. Terraform errors out with the below.
Error: Missing attribute separator
│
│ on terraform.tfvars line 5:
│ 5: filter = [ { name = “test1” desc = “test1” filter = <<EOT “multiline” EOT }, { name = “test2” description = “test2” filter = <<EOT “mutli line” EOT } ]
│
│ Expected a newline or comma to mark the beginning of the next attribute.
Tried using commas between name, desc, filter as well. Errors with comma added to values
Expected the start of an expression, but found an invalid expression token.