我在AWS System Manager中有一个参数,值类型为字符串,但是值具有字典结构:
值:
{" key1":" value1"," key2":" value2"," key3":" value3"}
现在,我正在尝试使用Terraform创建此参数。但是我在尝试在 aws_ssm_parameter Resource 中尝试编写此错误时收到了一个错误:
resource "aws_ssm_parameter" "Paramet" {
name = "/dev/parameter/new"
description = "Sample config values"
type = "String"
value = "{key1" : "value1", "key2" : "value2", "key3" : "value3}"
}
错误:
$ Terraform计划
错误:参数后缺少newline
在main.tf行90上,在资源" aws_ssm_parameter" paramet":90: value =" {key1":" value1"," key2":" value2"," key3":" value3}"
参数定义必须以newline结尾。
此错误与语法连接,但我不明白,如何正确修复此错误。
请建议,如何正确输入此值
您可以使用Heredoc语法来实现这一目标。以下应该为您工作
resource "aws_ssm_parameter" "Parameter" {
name = "/dev/parameter/new"
description = "Sample config values"
type = "String"
value = <<EOF
{
"key1" : "value1",
"key2" : "value2",
"key3" : "value3"
}
EOF
}