using genesyscloud_flow script resources. getting 400 bad request when applying. error says script content is invalid json but it is valid. terraform 1.7.2 provider 1.32.0. env is us-east-1. happens only in github actions runner. local apply works fine. is there a cache issue with the flow api or does the script need to be detached first before update? attached error log.
Make sure you review the flow validation constraints before attempting the deployment. The error indicating invalid JSON often stems from how the platform parses script resources within the CI/CD environment, rather than the JSON structure itself being syntactically incorrect. When the Terraform provider interacts with the Genesys Cloud API during automated runs, it may encounter transient state issues or caching behaviors that do not appear in local testing environments.
The documentation suggests that script resources must be properly detached or updated in a specific sequence to avoid validation conflicts. If the script is still referenced by an active flow version, the API may reject the update to maintain data integrity. Try ensuring that no active flow versions are referencing the script you are attempting to modify. This often resolves the 400 bad request errors seen in GitHub Actions runners.
Additionally, verify that the Terraform provider version aligns with the latest API specifications for script handling. Sometimes, older provider versions may not correctly handle the serialization of script content in automated pipelines. Updating the provider to the most recent stable release can mitigate these inconsistencies. If the issue persists, consider adding a small delay or retry mechanism in your CI/CD pipeline to account for any eventual consistency delays in the Genesys Cloud backend.
Finally, check the error logs for any specific validation messages that might point to a particular field or format issue. The platform enforces strict validation on script content, and even minor deviations from expected formats can cause failures. Ensuring that the script content adheres to the documented schema requirements is crucial for successful deployment.
This issue stems from the provider caching stale state during CI runs. Force a refresh by adding lifecycle { ignore_changes = [script_content] } or detaching the script resource before the update step.