Data Retention Policy 400 via Terraform - Conflict with Immutable Config

Why does this setting fail on apply? trying to enforce a strict data retention policy for a specific analytics domain via cx as code pipeline. provider genesyscloud version 1.68.4. region au-1.

the hcl validates locally. the api rejects the retention_days block for the ‘analytics’ domain.

Error: 400 Bad Request. “The requested configuration change violates system constraints. Immutable properties cannot be modified after initial creation for this domain.”

steps to reproduce:

  1. define the resource in main.tf:
resource "genesyscloud_dataretention_policy" "analytics_policy" {
 enabled = true
 policy_name = "Analytics Strict Retention"
 
 domain_config {
 domain = "analytics"
 retention_days = 365
 }
}
  1. run terraform plan. no errors. plan shows addition of new policy.
  2. run terraform apply.
  3. pipeline fails at the apply stage with the 400 error mentioned above.

context:
we are migrating from manual config to terraform. the legacy policy was created via ui years ago. we tried to import it using terraform import, but the import fails because the internal id structure does not match the provider expectations for the analytics domain.

we cannot delete the legacy policy manually because it is locked by compliance rules in the org settings. we need to overwrite it or update it via code to ensure consistency across envs.

the gc cli shows the existing policy has retention_days = 730. we want to reduce it to 365. the api seems to treat this as a modification of an immutable property rather than an update.

is there a way to force an update? or do we need to use the raw api endpoint PUT /api/v2/analytics/dataretention/policies/{id} directly in a local-exec provisioner? that feels like a hack but might be the only way.

anyone dealt with this immutable constraint on analytics retention via terraform? provider logs show no additional details. just the generic 400 message.