Having some config trouble here…
Terraform provider v1.95.0 fails on genesyscloud_conversations_ai_bot resource. HTTP 400 Bad Request during apply. Payload includes valid JSON for intent definitions.
Error: “Validation failed for field ‘intents’. Invalid structure provided.”
Using GC CLI to export shows correct schema. Direct API call succeeds. Terraform plan shows no changes. Apply fails immediately. Environment US East. Any known schema drift in recent provider releases?
The problem is likely that how Terraform serializes nested intent objects compared to the raw JSON structure the Genesys Cloud API expects. The provider often struggles with complex nested maps in the genesyscloud_conversations_ai_bot resource, especially when intent definitions contain conditional logic or variable references.
-
Check the exact structure of the intents block in your HCL. The API expects a specific nesting for intent_name, match_type, and conditions. If you are passing a raw JSON string, it often gets escaped incorrectly. Try defining the intent as a native HCL block instead.
-
Verify the match_type field. Recent provider versions are stricter about enum values. Ensure you are using FLEXIBLE or EXACT exactly as documented for v1.95.0. A mismatch here triggers the 400 validation error without a clear message.
-
Use the Genesys Cloud CLI to export the working bot configuration to HCL format. Run genesyscloud bot export --id <bot_id> --output-format=hcl. Compare the exported intents block with your current Terraform code. Look for missing fields like score or priority that might be required under load or specific schema versions.
-
If the issue persists, check for special characters in intent names. The API is sensitive to Unicode or non-standard spacing. Clean the intent names to alphanumeric only for testing.
Here is a minimal working example for a single intent:
resource "genesyscloud_conversations_ai_bot" "my_bot" {
name = "TestBot"
intents {
intent_name = "greeting"
match_type = "FLEXIBLE"
conditions {
type = "SIMILARITY"
text = "hello"
}
}
}
This structure usually bypasses the serialization issues seen in the provider.