I have the following terraform config:
resource "aws_dynamodb_table_item" "my_table" {
table_name = aws_dynamodb_table.my_table.name
hash_key = aws_dynamodb_table.my_table.hash_key
item = <<ITEM
{
"id": {"S": "nameAndCodes"},
"data": {"S": "[
{
"code": "03",
"displayName": "name1"
},
{
"code": "04",
"displayName": "name2"
}
]"}
}
ITEM
}
When the plan stage executes I receive the error:
Error: Invalid format of "item": Decoding failed: invalid character '
' in string literal
The only way i can get this to work is to make the whole json a single line as follows:
"data": {"S": "[{"code": "03", "displayName": "name1"},{"code": "04", "displayName": "name2"}]"
This looks very ugly and difficult to manage.
Does anyone know how I can enter a multiline JSON inside a <<ITEM block?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…