Genesys EventBridge integration sending duplicate events on Terraform apply

Applying genesyscloud_eventbridge_integration triggers duplicate events in AWS despite idempotency settings. The Terraform apply runs clean, but the EventBridge rule fires twice for the same conversation update. Here is the resource definition:

resource "genesyscloud_eventbridge_integration" "main" {
 name = "Prod Events"
 state = "ENABLED"
 events = ["conversation:updated"]
 aws_account_id = var.aws_account_id
}

Is there a known race condition in the provider or a deduplication flag I am missing?

Duplicate events on Terraform apply usually mean the API is creating a second integration instead of updating the existing one. The genesyscloud_eventbridge_integration resource needs an explicit ID reference to stay idempotent. Without it, terraform apply sees a mismatch and spins up a new resource.

Check if you’re missing the id attribute in your state or if the initial create failed silently. You can force the update by fetching the current ID via the API first.

curl -X GET "https://api.mypurecloud.com/api/v2/eventbridge/integrations" \
 -H "Authorization: Bearer $OAUTH_TOKEN" \
 -H "Accept: application/json" | jq '.entities[] | select(.name=="Prod Events") | .id'

Paste that ID into your Terraform state file or use -refresh=false if you’re sure the cloud object matches. Also, verify your AWS EventBridge rule isn’t set to retry on failure, which can double-fire if the first payload is malformed. The Genesys side is usually the culprit though.