Predictive Outbound Campaign API 409 Conflict during Terraform Apply

Quick question about handling resource conflicts when managing predictive outbound campaigns via the Genesys Cloud Terraform provider.

We are automating the deployment of predictive dialing configurations using terraform-provider-genesyscloud version 1.48.2. The setup involves creating a genesyscloud_outbound_campaign resource linked to a specific contact list and wrap-up code. During the terraform apply phase, the operation consistently fails with a 409 Conflict error. The error message indicates that the campaign name already exists, despite the fact that we are using dynamic naming conventions based on the environment variable and a unique suffix generated by Terraform. The API endpoint returning the conflict is /api/v2/outbound/campaigns. We have verified that no duplicate campaigns exist in the target environment by querying the /api/v2/outbound/campaigns endpoint directly via the GC CLI. The response from the CLI shows only the intended campaign, yet the provider refuses to create or update the resource. We suspect this might be related to the internal state management of the provider or a race condition in the API validation layer. The campaign configuration includes standard predictive settings such as dialer_settings with a predictor type set to predictive and specific answer_machine_detection parameters. We have also tried adding a depends_on block to ensure the contact list is fully provisioned before the campaign creation, but the issue persists. The logs show that the provider is attempting a PUT request to update an existing resource ID, but the API returns a conflict because the name check fails. This behavior is inconsistent with other resources like genesyscloud_outbound_contact_list, which handles updates gracefully. We need a reliable way to handle this conflict in our CI/CD pipeline without manual intervention. Is there a specific attribute or workaround recommended for predictive campaigns to avoid these naming conflicts during automated deployments? The current error blocks our entire deployment pipeline, causing significant delays in our release cycle. Any insights into the provider’s handling of predictive campaign resources would be appreciated.

Check your campaign dependencies and state file synchronization. Migrating from Zendesk to Genesys Cloud often involves replicating complex workflow logic, and Terraform can struggle with the asynchronous nature of Genesys Cloud resources. The 409 Conflict usually indicates that the resource already exists but the state file is out of sync, or a dependent resource like the contact list isn’t fully provisioned yet.

Try adding a depends_on block to ensure the contact list is created before the campaign. Also, verify that you aren’t trying to update a campaign that is currently active. In Zendesk, you could often edit active views, but Genesys Cloud locks active campaigns.

resource "genesyscloud_outbound_campaign" "my_campaign" {
 depends_on = [genesyscloud_outbound_contactlist.my_list]
 
 name = "Migrated Zendesk Queue"
 contact_list_id = genesyscloud_outbound_contactlist.my_list.id
 # Ensure no other conflicting updates are pending
}

Run terraform plan again after importing the existing state if needed. This mirrors how we handle SLA mapping conflicts during migrations.