Genesys Cloud - Developer Community!

 View Only

Sign Up

genesyscloud_tf_export generates invalid output: Problems with exporting email routes

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

    Posted 6 hours 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
    ------------------------------