I'm writing a terraform module for GCP uptime checks and I need to filter {"message":"ok"} in response body.
Need to pass {"message":"ok"} as a variable, but still cannot find the suitable variable type for it.
I tried complex variable types. But issue not resolved yet
I think you can use a map
as variable, example:
variable.tf
file:
variable "message" {
description = "Message"
type = map
default = {
"message" = "ok"
}
}
Display the message value in the outputs.tf
file for example:
output "message_value" {
value = var.message["message"]
}
Thanks all This is resolved by using jsonencode({ "message": "ok" })
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.