Genesys Cloud - Developer Community!

 View Only

Sign Up

Expand all | Collapse all

genesyscloud_tf_export generates invalid output: Problems with exporting email routes

  • 1.  genesyscloud_tf_export generates invalid output: Problems with exporting email routes

    Posted 3 days ago

    Hi,

    I am evaluating if "CX as code" can be used to provide a backup for a client org - i.e. if it is possible to periodically export the current status into terraform files, and in case of a desaster use these terraform files for re-creating (at least most of) the setup.

    When an email route is exported which has a self-reference in it's "reply_email_address" field, then at first this is not really exported correctly - instead it contains the route_id of the route itself; "terraform plan" then complains about self-referential route_id's.

    After I fixed this by changing the reply_email_address object to 

    reply_email_address {
        self_reference_route = true
      }
    

    terraform is happy about it. When applying this change with "terraform apply", this is also accepted.

    But if I re-export the updated email route, it looks like this again:

      reply_email_address {
        domain_id            = "${genesyscloud_routing_email_domain.atositsolutionsandservicesgmbh_mypurecloud_de.id}"
        self_reference_route = true
      }
    

    "Terraform plan" again complains about a conflict:

    Error: Conflicting configuration arguments

      with genesyscloud_routing_email_route.some-route-name,
      on genesyscloud_routing_email_route.tf line 5, in resource "genesyscloud_routing_email_route" "some-route-name":
       5:     self_reference_route = true

    "reply_email_address.0.self_reference_route": conflicts with
    reply_email_address.0.domain_id

    After I remove the offending route_id line, it is OK again.

    If the element is already marked with "self_reference_route = true" - why does the exporter still add a "domain_id"? This is bound to make troubles.

    There is also a second error message, because if "domain_id" is present, then "route_id" must also be set - again, this is useless, as the ID is self-referential again.

    This is a real problem when trying to use the terraform provider as backup source, because it forces us to hand-edit the backups before using them as imports again.

    Can the exporter be fixed to automatically detect this and implement, for example, a precedence logic so that if "self_reference_route = true", then the "domain_id" is suppressed?

    Thanks in advance,

    Wolfgang Liebich


    #CXasCode

    ------------------------------
    Wolfgang Liebich
    ------------------------------


  • 2.  RE: genesyscloud_tf_export generates invalid output: Problems with exporting email routes

    Posted 2 days ago

    This behavior is a known issue with the CX as Code exporter: when an email route uses self_reference_route = true, the exporter still injects a domain_id (and sometimes route_id), even though these fields conflict with a self‑referential configuration. As a result, the generated Terraform configuration becomes invalid unless it is manually corrected.

    At the moment, there is no official fix available in the exporter or in the Terraform provider, and the problem is still described in community discussions rather than resolved. This means that any route using self_reference_route may require manual cleanup after export.

    Given the current behavior, the most reliable workarounds are:

    1. Post‑processing the exported files
      Automatically remove domain_id and route_id whenever self_reference_route = true is present. Several teams are already using scripts to sanitize exported configurations for this reason.

    2. Temporarily excluding email routes from automatic export
      Managing these routes manually can avoid invalid configurations until a fix is released.

    3. Opening or supporting a GitHub issue
      Reporting the problem directly in the Terraform provider repository will help increase visibility and priority for a fix.

    Ideally, the exporter should implement a simple precedence rule:

    if self_reference_route == true:
        omit domain_id
        omit route_id
    

    This would ensure clean and conflict‑free exports.



    ------------------------------
    Cesar Padilla
    INDRA COLOMBIA
    ------------------------------