Legacy Dev Forum Posts

 View Only

Sign Up

Terraform: create resources based on exported resource files

  • 1.  Terraform: create resources based on exported resource files

    Posted 06-05-2025 19:35

    Julio_Masuda | 2024-07-02 20:51:08 UTC | #1

    Hi, Sorry, I'm new to CX as Code and Terraform and I'm reading a lot of documents and videos on this topic. My main goal is to import an architect flow and its dependencies (e.g. data action) and create this flow and dependencies in another Gen Cloud org. At this moment, I was able to:

    • Get the flow via Archy and save it to a YAML file
    • Get the flow resource and all their dependencies (e.g. data actions) via Terraform:

    resource "genesyscloudtfexport" "exportflow" { directory = "./genesyscloud/flow" exportashcl = true logpermissionerrors = true includestatefile = true enabledependencyresolution = true splitfilesbyresource = true includefilterresources = ["genesyscloud_flow::Name of architect flow"] } This export generated several TF files in the "genesyscloud/flow" folder containing the flow and dependent resources.

    However, I'm stuck at this point: How to take all this information and create these resources in another Genesys Cloud Organization?

    I know I could insert resource by resource into the main.tf file and then create them in the new environment, but would there be a way to create these resources from the resource files in the “flow” folder?

    I would appreciate any suggestions.

    Thanks in advanced. Julio Masuda


    Kavin_Bala | 2024-07-03 15:22:56 UTC | #2

    Hi @Julio_Masuda

    Before you export, make sure that the field `include_state_file` is set to `false` , this is to prevent the exported config doesn't contain any GUIDs that are specific to that org. Then all you have to do is to `cd` into the export folder, swap the OAuth credentials for the new target org and run `terraform init` and `apply` for the contents that got exported.


    Julio_Masuda | 2024-07-05 15:49:26 UTC | #4

    Hi @Kavin_Bala , I finally understood what you suggested and it worked correctly. Thank you very much ! I would just like to let other people interested in this topic know what I did: Export the resources to local folder

    1. Get the flow via Archy and save it to a YAML file
    2. Get the flow resource and all their dependencies (e.g. data actions) via Terraform:

    resource "genesyscloudtfexport" "exportflow" { directory = "./genesyscloud/flow" exportashcl = true logpermissionerrors = true includestatefile = false enabledependencyresolution = true splitfilesbyresource = false includefilterresources = ["genesyscloud_flow::Name of architect flow"] } This export generated in the "genesyscloud/flow" folder:

    • "scripts" subfolder
    • genesyscloud.tf
    • terraform.tfvars

    Import resources to another organiztion

    1. created a new folder
    2. copied into this folder:
    3. "scripts" subfolder
    4. genesyscloud.tf
    5. terraform.tfvars
    6. I changed the credentials data in the genesyscloud.tf file to another organization's credentials.
    7. Executed:

    terraform.exe init terraform.exe plan

    1. This last command will generate some error messages and you will have to edit genesyscloud.tf to fix the reported problems.
    2. Finally I executed:

    terraform.exe apply

    Sorry, I haven't exported the yaml flow to the other organization yet. I'll still work on that.

    Best regards, Julio Masuda


    Julio_Masuda | 2024-07-05 21:17:48 UTC | #5

    Just complementing the previous post, I was also able to create the flow via Terraform in the other organization:

    1. Copy the yaml file to new folder
    2. Edit genesyscloud.tf file:

    resource "genesyscloudflow" "INBOUNDCALLArchitectflow" { dependson = [genesyscloudroutingqueue.someQueue, genesyscloudintegrationaction.someAction] filecontenthash = filesha256("${path.module}/architectflow.yaml") filepath = "${path.module}/architectflow.yaml" }

    1. Execute:

    terraform.exe plan terraform.exe apply

    Best regards, Julio Masuda


    system | 2024-08-04 21:17:57 UTC | #6

    This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


    This post was migrated from the old Developer Forum.

    ref: 27052