I have a list of objects in which one element operand could be of dynamic type a string, number or a map.
I defined the variable as follow:
variable "settings" {
type = list(object({
type=string
operator=string
operand=any
...
}))
}
And from calling module, assigning values like below:
settings = [
{ "operator" = "lessThan", "type" = "responseTime", "operand" = 10000 },
{ "operator" = "is", "type" = "statusCode", "operand" = 200 },
{ "operator" = "is", "property" = "content-type", "type" = "header", "operand" = "abc" },
{ "operator" = "validatesJSONPath", "type" = "body", "operand" = { "operator" = "contains", "operandValue" = "google", "jsonPath" = "id" } }
]
However, this is throwing me following error:
The given value is not suitable for child module variable "settings" defined at operator\variables.tf:64,1-21: cannot find a common base type for all elements.
How best can I address this?