Is it possible to import an existing agent script into Terraform state without triggering a conflict on the content hash?
Environment details:
Terraform v1.9.8
Genesys Cloud Provider v1.65.2
Region: Australia/Sydney
Category: Agent Scripting
I am attempting to manage an existing agent script via genesyscloud_script. The script was created manually in the UI. When I run terraform import, it succeeds. However, the next terraform plan shows a diff in the content field, specifically the internal JSON structure of the script nodes. The provider seems to be normalizing the JSON differently than the API response.
Running terraform apply results in a 409 Conflict error:
Error: PUT https://api.au.genesys.cloud/api/v2/scripts/12345: 409 Conflict
Message: Script content is already in use or conflicts with existing version.
The HCL block is straightforward:
resource "genesyscloud_script" "test_script" {
name = "Test Script"
description = "Managed by TF"
content = file("script-content.json")
}
The script-content.json is exported directly from the API. I have tried using ignore_changes on the content field, but this prevents any future updates to the script via Terraform, which defeats the purpose of IaC. I need a way to import the resource while keeping the state in sync with the exact JSON payload, or a method to suppress the false positive diff on the content hash. Any suggestions on how to handle the JSON normalization difference between the provider and the API?