Why does this config cause a 400 error on update?
Using Genesys Cloud CLI v2.1.0 in AU-1 BYOC.
Automating agent script updates via Terraform and CLI scripts.
Resource: genesyscloud_script.
Provider: genesyscloud v1.68.4.
The script applies fine initially. No errors.
The issue arises on the second apply.
Specifically when updating step_content with variable mappings.
The error is generic. Invalid request body.
No field specified.
The payload looks correct.
Validated against OpenAPI spec.
Here is the relevant HCL snippet.
resource “genesyscloud_script” “main” {
name = “Test Script”
description = “Automated test”
steps {
step_name = “Greeting”
type = “text”
content = “Hello, this is {{variable_name}}”
}
}
The variable_name exists in the script definition.
It is defined correctly.
Terraform plan shows no changes to the variable.
But the apply fails.
400 Bad Request.
Tried removing the variable.
Apply succeeds.
Added it back.
Fails again.
Seems like a conflict in the step_content structure.
Or maybe the CLI is not handling the nested object correctly.
Checked the API docs.
The endpoint PUT /api/v2/scripts/{scriptId} requires the full object.
The CLI should be doing this.
But it seems to send a partial update.
Or maybe the order of keys matters.
JSON is unordered.
But the API might be strict.
Tried reordering the keys.
No change.
Tried using the raw API call.
Still 400.
The error message is not helpful.
Just says invalid body.
Need to know what is invalid.
Is it the variable syntax?
Or the step type?
The step type is text.
That is valid.
The variable syntax is {{name}}.
That is standard.
So what is wrong?
Any ideas on how to debug this?
Or is this a known bug in the provider?
Seen similar issues with flows.
But scripts should be simpler.
Unless the variable mapping is tricky.
Please advise.