The nightly pipeline failed three times in a row. Terraform 1.7.4 keeps flagging changes on nice_cxone_routing_user resources after the initial apply. WebRTC softphone provisioning sits inside the standard onboarding module. It’s part of the automated agent setup. The pipeline pushed 40 agent profiles last Thursday. Console shows the toggle is active. terraform plan immediately reports a diff on web_rtc_enabled and audio_codecs. The provider reads the API response differently than what it wrote.
Debug logs point to a 400 response during the first PUT. The payload includes web_rtc_enabled: true and a hardcoded codec list. CXone API returns 400 Bad Request: Unsupported codec negotiation for WebRTC endpoint. The provider swallows the error on the first run but leaves the resource in a partial state. Subsequent plans detect the mismatch. State drift backup shows the remote state has web_rtc_enabled = false while the API actually returned true with a truncated codec array. The state file is doing jack all to match the API response.
Tried the following:
- Removed
audio_codecsblock entirely to let the API default. Plan still shows drift after 2 hours. - Added
lifecycle { ignore_changes = [web_rtc_enabled, audio_codecs] }. Suppresses the plan diff but breaks the destroy cycle. Won’t touch prod with that config. - Ran
terraform refresh -target=nice_cxone_routing_user.agent_pool. Output matches the console but the state file still marks it as modified. - Checked provider version 1.11.8. Same behavior. Upgraded to 1.12.0 per release notes. Can’t get past the ordering mismatch.
The console auto-adjusts the codec list to opus-48, g722, pcma. Terraform expects the exact array passed in the config. The API documentation says the field is read-only after creation, but the provider schema marks it as optional and mutable. This mismatch is causing the constant plan noise. Drift backups are piling up in the S3 bucket. The mic stays hot on the softphone test but the IaC run complains about every single attribute.
Need to know if the provider team patched the read-after-write logic for WebRTC attributes. The debug trace shows the GET request returns a different structure than the PUT payload. Logs attached below.
resource "nice_cxone_routing_user" "agent" {
email = var.agent_email
name = var.agent_name
web_rtc_enabled = true
audio_codecs = ["opus-48", "pcma", "pcmu"]
routing_email = var.routing_email
}
2024-05-12T09:14:22.105Z [DEBUG] provider: GET /api/v2/routing/users/{id} returned 200. Body codec array length: 3. Expected: 3. Mismatch on ordering.
2024-05-12T09:14:22.108Z [WARN] state: detected drift on attribute web_rtc_enabled. Value changed from true to false.