Stuck on a 400 Bad Request when attempting to create an Agent Scripting resource via Terraform. The deployment pipeline fails at the genesyscloud_script step.
Environment details:
- Provider:
genesyscloud/genesyscloudv1.9.4 - Region: au-1
- Module:
genesyscloud_script - Target: Agent Scripting (Architect)
The HCL configuration defines a simple script with a single text-to-speech block. The payload appears valid when manually tested via Postman against the Genesys Cloud API, but the provider throws a generic 400 error without specific field validation details in the stderr output.
Here is the relevant HCL snippet:
resource "genesyscloud_script" "welcome_script" {
name = "Welcome_Message_v1"
description = "Automated welcome message for IVR"
script {
version = "1.0"
content = jsonencode({
"blocks" = [
{
"id" = "tts-1"
"type" = "text-to-speech"
"settings" = {
"text" = "Hello, thank you for calling."
}
}
]
})
}
}
The error log shows:
Error: POST https://api.au-1.genesys.cloud/api/v2/architect/scripts: 400 Bad Request
Response: {
"code": "bad_request",
"message": "Invalid script content structure",
"status": 400
}
I have verified the JSON structure against the OpenAPI spec. The content field requires a JSON-encoded string, which is handled by jsonencode(). However, the provider seems to reject the payload before sending, or the API response is misleading.
Quote from documentation:
“The script content must be a valid JSON string representing the Architect flow structure. Ensure all block IDs are unique and types are supported.”
Is there a specific schema validation issue with v1.9.4 for Agent Scripting? Or is the genesyscloud_script resource not fully supported for this specific flow type yet? Need to unblock the CI/CD pipeline. Any insights on debugging the payload sent by the provider?