Trying to make sense of why the Genesys Cloud Terraform provider (v2.1.0) returns a 400 Bad Request when referencing an existing Contact List ID in an Outbound Campaign resource.
The deployment pipeline runs via GitHub Actions using GC CLI v1.5.4 for authentication. The Contact List is created in a separate module and its ID is passed as an output variable to the Campaign module. The ID format is valid UUID.
Error log from terraform apply:
Error: POST /api/v2/outbound/campaigns failed with 400
Body: {
“code”: “badRequest”,
“status”: 400,
“message”: “Invalid listId provided. List must be associated with the same organization.”
}
Both resources are deployed to the same Org ID. Verified via API explorer that the Contact List exists and is active. The JSON payload generated by Terraform looks correct:
resource “genesyscloud_outbound_campaign” “primary” {
name = “QA_Test_Campaign”
contact_list_id = var.contact_list_id
strategy_id = “default”
status = “paused”
}
Checked the raw HTTP request in debug logs. The header contains correct Bearer token and Org ID. No CORS issues. The endpoint /api/v2/outbound/campaigns expects a listId that matches an outbound contact list.
Is there a specific permission scope required for the service account used in the pipeline? The role assigned is ‘Outbound Manager’ and ‘Contact List Admin’.
Also noticed that if I create the campaign manually in the UI with the same list ID, it works fine. The issue seems isolated to the API call made by the Terraform provider during the initial creation step.
Any known issues with list ID validation in provider v2.1.0? Or is this a timing issue where the list ID is not fully propagated before the campaign resource attempts to link it? Adding a null_resource with local-exec to sleep for 30 seconds before applying the campaign might help, but looking for a cleaner solution using depends_on or data sources if possible.
Environment:
- Terraform v1.6.0
- Genesys Cloud Provider v2.1.0
- GC CLI v1.5.4
- Region: ap-southeast-2
Any insights appreciated.