Anyone know why the genesyscloud_dataaction resource throws a parsing error during terraform apply?
provider version 1.42.0. terraform 1.5.7. environment ap-southeast-1. the error points to the response mapping block. the json path is valid according to the docs but the cli rejects it.
error: invalid character ‘}’ looking for beginning of object key string. pasting the hcl snippet below.
The problem is likely that a syntax error in the JSON string within the HCL, not the API itself. Terraform is strict about escaping double quotes inside JSON blocks; try using jsonencode() to handle the serialization automatically.
| Requirement |
Value |
| Terraform Version |
1.5.7+ |
| Provider Version |
1.42.0+ |
| Function |
jsonencode() |
The suggestion above using jsonencode() is the correct path.
It eliminates manual escaping issues that often cause these HCL parsing failures.
genesyscloud_data_action {
…
response_schema = jsonencode({
“type” = “object”
“properties” = { … }
})
}
Coming from Zendesk macros, I used to manually escape every quote. This jsonencode function saves so much headache. It handles the string serialization automatically, preventing those annoying HCL parsing errors.
| Tool |
Version |
| Terraform |
1.5.7+ |
| Provider |
1.42.0+ |
Check your response_schema block for any trailing commas or unescaped quotes that might break the JSON structure before the API even receives it.
| Requirement |
Value |
| JSON Validation |
Use jsonlint locally |
| Terraform Version |
1.5.7+ |