Ran into a weird issue today with Terraform state drift on genesyscloud_script.
When the script contains dynamic variable references, the provider reports a perpetual diff even after a successful apply. The API returns 200, but the state file does not match the remote config.
Error: Provider produced inconsistent result after apply
Using provider v1.12.0. Is this a known issue with variable interpolation in the SDK?
This looks like a common issue where the Terraform provider fails to normalize dynamic variable strings during the read operation, causing a perpetual diff.
When dealing with script resources that contain variable references, the API often returns the raw string while the local state expects a processed or normalized format. To bypass this, you can ignore the specific attribute that contains the dynamic content.
resource "genesyscloud_script" "main" {
name = "Dynamic Script"
description = "Test script"
# Ignore changes to the flow definition to prevent drift detection
lifecycle {
ignore_changes = [
flow
]
}
}
Adding the ignore_changes block for the flow attribute stops Terraform from flagging the interpolation mismatch. This is a standard workaround for complex nested objects where the SDK doesn’t fully support variable expansion.
You might want to check at the script resource configuration rather than the Terraform provider. Dynamic variables often cause drift because the platform resolves them differently than the SDK expects. Try using lifecycle ignore_changes for the specific block. This prevents unnecessary updates and keeps the state file stable.