[英]What is the variable type for {"message":"ok"} in terraform
I'm writing a terraform module for GCP uptime checks and I need to filter {"message":"ok"} in response body.我正在为 GCP 正常运行时间检查编写一个 terraform 模块,我需要在响应正文中过滤 {"message":"ok"}。
Need to pass {"message":"ok"} as a variable, but still cannot find the suitable variable type for it.需要将{"message":"ok"}作为变量传递,但仍然找不到合适的变量类型。
I tried complex variable types.我尝试了复杂的变量类型。 But issue not resolved yet
但是问题还没有解决
I think you can use a map
as variable, example:我认为您可以使用
map
作为变量,例如:
variable.tf
file: variable.tf
文件:
variable "message" {
description = "Message"
type = map
default = {
"message" = "ok"
}
}
Display the message value in the outputs.tf
file for example:在
outputs.tf
文件中显示消息值,例如:
output "message_value" {
value = var.message["message"]
}
Thanks all This is resolved by using jsonencode({ "message": "ok" })谢谢大家 这是通过使用jsonencode({ "message": "ok" })解决的
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.