My configuration keeps failing…
Running terraform plan shows constant drift on genesyscloud_sip_trunk resources in our AU-East environment. The remote state differs from the HCL configuration, specifically on the outbound_host and failover_host attributes.
The pipeline executes via GitHub Actions using the latest genesys/genesyscloud provider. The error log indicates a mismatch in the SIP URI format expected by the API versus what Terraform stores.
# genesyscloud_sip_trunk.main will be updated in-place
~ resource "genesyscloud_sip_trunk" "main" {
~ outbound_host = "sip.provider.com:5060" -> "sip.provider.com"
}
Checking the SIP Trunk API documentation suggests the port should be optional if 5060 is used, but the CLI output retains the port. This causes the state file to diverge on every run, forcing manual terraform state rm or ignoring changes, which breaks our Infrastructure as Code integrity.
Is there a known issue with the provider normalizing SIP URIs? Or should we be using a custom normalizer in the HCL block to strip the port before comparison?
I’d suggest checking out at the exact URI format in the HCL, as the API often normalizes trailing slashes or port numbers, causing false drift. Check if the remote state has added a default port like 5060 while your config omits it.
This happens because the provider’s strict normalization of SIP URIs, which often diverges from the raw input in HCL files, similar to how Zendesk ticket IDs are auto-generated and immutable once created.
In Zendesk, we simply defined a webhook URL, and the system handled the formatting behind the scenes. Genesys Cloud’s Terraform provider, however, explicitly normalizes outbound_host and failover_host attributes by appending default ports (like 5060 for SIP) if they are omitted in the configuration file. This creates a perpetual state drift because the remote API returns the normalized value, while your HCL file retains the original, un-normalized string. To resolve this, you must align your Terraform configuration with the exact format returned by the Genesys Cloud API. Instead of relying on implicit defaults, explicitly define the port in your HCL to match the API’s expectation. This approach mirrors the precision required when mapping Zendesk custom fields to Genesys Cloud interaction attributes, where implicit mappings rarely survive a full audit. By enforcing the explicit port definition, the plan will show no changes, ensuring a clean state.
resource "genesyscloud_sip_trunk" "my_trunk" {
name = "AU-East Trunk"
outbound_host = "sip.myprovider.com:5060" # Explicitly include port
failover_host = "sip.backupprovider.com:5060" # Explicitly include port
# Ensure other attributes like transport_type match exactly
transport_type = "TCP"
}
Aligning the HCL syntax with the API’s normalized output eliminates the drift, much like ensuring Zendesk ticket form rules match the underlying field data types.