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 "genesyscloud_tf_export" "export_flow" {
directory = "./genesyscloud/flow"
export_as_hcl = true
log_permission_errors = true
include_state_file = true
enable_dependency_resolution = true
split_files_by_resource = true
include_filter_resources = ["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?
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.
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
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 "genesyscloud_tf_export" "export_flow" {
directory = "./genesyscloud/flow"
export_as_hcl = true
log_permission_errors = true
include_state_file = false
enable_dependency_resolution = true
split_files_by_resource = false
include_filter_resources = ["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
created a new folder
copied into this folder:
"scripts" subfolder
genesyscloud.tf
terraform.tfvars
I changed the credentials data in the genesyscloud.tf file to another organization's credentials.
Executed:
terraform.exe init
terraform.exe plan
This last command will generate some error messages and you will have to edit genesyscloud.tf to fix the reported problems.
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.