json2hcl
json2hcl copied to clipboard
Wrong json output
According to README, the conversion of
"output" "arn" {
"value" = "${aws_dynamodb_table.basic-dynamodb-table.arn}"
}
will return
{
"output": [
{
"arn": [
{
"value": "${aws_dynamodb_table.basic-dynamodb-table.arn}"
}
]
},
... rest of JSON truncated
]
}
This is not correct, the return value should be
{
"output": {
"arn": {
"value": "${aws_dynamodb_table.basic-dynamodb-table.arn}"
}
},
... rest of JSON truncated
}
An HCL object is unnecessarily converted into a tuple.
Similar errors have been reported many times (e.g. https://github.com/kvz/json2hcl/issues/4, #10). The problem is that the official HCL parser library that we use, does not produce the same output as you input because there are multiple serialized version for a given HCL file. This comment contains two links with more details: https://github.com/kvz/json2hcl/issues/4#issuecomment-275513256