Genesys Cloud - Developer Community!

 View Only

Sign Up

  • 1.  How to export queue with it's dependency and nested dependency using CX as code

    Posted 05-15-2025 09:17
    Edited by Hari Shankar 05-15-2025 09:25

    I am trying to export the Queue, which has a dependency on Person, and Person has a dependency on Roles. I am trying to export the queue with all the dependencies and nested dependencies using cx as code.

    I tried the below .tf file 

    terraform {
      required_providers {
        genesyscloud = {
          source  = "mypurecloud/genesyscloud"
          version = "~> 1.10"
        }
      }
    }
     
    provider "genesyscloud" {
      oauthclient_id     = var.client_id
      oauthclient_secret = var.client_secret
      aws_region         = var.region
    }
     
    resource "genesyscloud_tf_export" "include-filter" {
      directory                    = "./genesyscloud/include-filter"
      export_format                = "hcl"
      log_permission_errors        = true
     
      include_filter_resources = [
        "genesyscloud_routing_queue::^shalini_queue_6_may_001$"
      ]
     
      enable_dependency_resolution = true
    }
    But not able to achieve my requirement it generate below .tf file which doesn't have explanation for the Roles which is mapped on Person and that person is the dependency of the queue that i am trying to export,
    terraform {
      required_providers {
        genesyscloud = {
          source  = "registry.terraform.io/mypurecloud/genesyscloud"
          version = "1.63.0"
        }
      }
    }
     
    resource "genesyscloud_auth_division" "Home" {
      description = "description"
      home        = true
      name        = "Home"
    }
     
    resource "genesyscloud_routing_language" "German" {
      name = "German"
    }
     
    resource "genesyscloud_routing_queue" "shalini_queue_6_may_001" {
      enable_manual_assignment = false
      enable_transcription     = false
      media_settings_email {
        alerting_timeout_sec      = 300
        enable_auto_answer        = false
        service_level_duration_ms = 86400000
        service_level_percentage  = 0.8
      }
      members {
        ring_num = 1
        user_id  = "${genesyscloud_user.shalini15may_gmail_com.id}"
      }
      enable_audio_monitoring = false
      media_settings_message {
        alerting_timeout_sec      = 30
        enable_auto_answer        = false
        service_level_duration_ms = 20000
        service_level_percentage  = 0.8
      }
      suppress_in_queue_call_recording = true
      skill_evaluation_method          = "ALL"
      acw_wrapup_prompt                = "OPTIONAL"
      media_settings_call {
        enable_auto_answer        = false
        service_level_duration_ms = 20000
        service_level_percentage  = 0.8
        alerting_timeout_sec      = 8
      }
      name             = "shalini_queue_6_may_001"
      scoring_method   = "TimestampAndPriority"
      auto_answer_only = false
      media_settings_chat {
        alerting_timeout_sec      = 30
        enable_auto_answer        = false
        service_level_duration_ms = 20000
        service_level_percentage  = 0.8
      }
      division_id = "${genesyscloud_auth_division.Home.id}"
      media_settings_callback {
        auto_end_delay_seconds    = 300
        auto_dial_delay_seconds   = 300
        service_level_percentage  = 0.8
        alerting_timeout_sec      = 30
        enable_auto_answer        = false
        enable_auto_dial_and_end  = false
        mode                      = "AgentFirst"
        service_level_duration_ms = 20000
      }
    }
     
    resource "genesyscloud_routing_skill" "ACD_Skill1" {
      name = "ACD Skill1"
    }
     
    resource "genesyscloud_routing_skill" "ACD_Skill2" {
      name = "ACD Skill2"
    }
     
    resource "genesyscloud_user" "shalini15may_gmail_com" {
      division_id = "${genesyscloud_auth_division.Home.id}"
      routing_skills {
        proficiency = 0
        skill_id    = "${genesyscloud_routing_skill.ACD_Skill1.id}"
      }
      routing_skills {
        proficiency = 3
        skill_id    = "${genesyscloud_routing_skill.ACD_Skill2.id}"
      }
      email           = "shalini15may@gmail.com"
      state           = "active"
      acd_auto_answer = false
      routing_languages {
        language_id = "${genesyscloud_routing_language.German.id}"
        proficiency = 3
      }
      name = "shalini15may"
    }
     
    please help me how i can do that using cx as code


    #CXasCode

    ------------------------------
    Hari Shankar
    Genesys Specialist
    ------------------------------



  • 2.  RE: How to export queue with it's dependency and nested dependency using CX as code

    Posted 05-15-2025 11:29

    I'm still learning CX as Code It looks like it's missing the roles try adding "genesyscloud_user::." and"genesyscloud_auth_role::." to your export. 



    ------------------------------
    Allen Coley
    Senior Principal PS Consultant
    ------------------------------



  • 3.  RE: How to export queue with it's dependency and nested dependency using CX as code

    Posted 05-16-2025 01:59

    Hi Coley,

    I want to replicate my queue with all the dependencies and nested dependencies in a production environment

    I wrote the Terraform file to export the queue (that I already shared), and it generated the Terraform file, which have the dependency details for User and user dependency skill and language. my user also has a dependency on Roles but that is not defined in the exported Terraform file.

    My question is if it is exporting the user and the skill of the user, so why is it not exporting the role of the user?

    if i will define "genesyscloud_user::." and"genesyscloud_auth_role::."  this to export queue it will increase manual work.



    ------------------------------
    Hari Shankar
    Genesys Specialist
    ------------------------------



  • 4.  RE: How to export queue with it's dependency and nested dependency using CX as code

    Posted 05-16-2025 14:52

    Hari - 

    What you are doing you are doing correctly. The User object does not have any reference to Roles so there will be no role information.
    Users and Roles are defined together in a different object: genesyscloud_user_roles.
    It is a separate table of information. So, you would need to use the user ID from the user object to get a list of Roles from genesyscloud_user_roles.



    ------------------------------
    Douglas Folken
    N/A (not with company)
    ------------------------------



  • 5.  RE: How to export queue with it's dependency and nested dependency using CX as code

    Posted 05-19-2025 01:59

    Hi Douglas,

    So here, my understanding is that if I try to export a Queue with all its dependencies, it will export the User and the user's skill and language, but it will not export the user's roles.

    To export the user's role, we have to write a separate terraform file, or can we adjust the existing one? 

    terraform {
      required_providers {
        genesyscloud = {
          source  = "mypurecloud/genesyscloud"
          version = "~> 1.10"
        }
      }
    }
     
    provider "genesyscloud" {
      oauthclient_id     = var.client_id
      oauthclient_secret = var.client_secret
      aws_region         = var.region
    }
     
    resource "genesyscloud_tf_export" "include-filter" {
      directory                    = "./genesyscloud/include-filter"
      export_format                = "hcl"
      log_permission_errors        = true
     
      include_filter_resources = [
        "genesyscloud_routing_queue::^shalini_queue_6_may_001$"
      ]
     
      enable_dependency_resolution = true
    }



    ------------------------------
    Hari Shankar
    Genesys Specialist
    ------------------------------



  • 6.  RE: How to export queue with it's dependency and nested dependency using CX as code

    Posted 05-19-2025 08:37

    Hi Hari,

    The export will walk the dependency tree between that exist between objects.  Genesys Cloud Users and Genesys Cloud User roles are separate objects, and there is no direct linkage between them so the exporter will not export them.  You can add another include_filter_resources record to the export the user roles.

    Thanks,
        John



    ------------------------------
    John Carnell
    Director, Developer Engagement
    ------------------------------



  • 7.  RE: How to export queue with it's dependency and nested dependency using CX as code

    Posted 05-20-2025 01:09
    Edited by Hari Shankar 05-20-2025 05:46

    Thanks for the information.

    Is there any Genesys document explaining the dependency tree between the entities? can you please share the link to that document?

    genesyscloud_user_roles, with this I found we can assign a role to the user, but how can we export the role for the specific user, because I want to replicate the same user in the Prod environment using cx as code
    ------------------------------
    Hari Shankar
    Genesys Specialist
    ------------------------------