Closed jnunezgts closed 1 year ago
Hello,
I'm trying to encode a map into the following format:
resource "grafana_data_source" "prometheus" { json_data_encoded = jsonencode({ httpMethod = "POST" prometheusType = "Mimir" prometheusVersion = "2.4.0" })
What I found from the documentation is that cty provides out of the box support to encode Strings, Boolean and other primitives like this:
flt, check := value.(float64) if check { resourceBody.SetAttributeValue(key, cty.NumberFloatVal(flt)) }
There is a way to achieve the same with a map[string]interface{}?
map[string]interface{}
I was looking through the documentation but I could not find anything that resembles what I need to do.
Thanks.
Hi @jnunezgts!
I'm afraid I'm not sure exactly what you are asking, but this seems like it's a Terraform question rather than a cty question, so I'd suggest asking it in Terraform's forum instead. Thanks!
cty
Hello,
I'm trying to encode a map into the following format:
What I found from the documentation is that cty provides out of the box support to encode Strings, Boolean and other primitives like this:
There is a way to achieve the same with a
map[string]interface{}
?I was looking through the documentation but I could not find anything that resembles what I need to do.
Thanks.