Once I hear back from you on this preference, I'll post my questions accordingly.
The article and your post above both definitely helped me understand some things, particularly around how variables are used to deal with different ID's, potentially different names, etc. between dev and prod. It has, however, spawned a decent number of questions...
Original Message:
Sent: 10-01-2025 10:50
From: Lucas Woodward
Subject: Best source(s) of info on how to get started with CI/CD if orgs already exist?
I finally finished writing the article that hopefully answers your questions: https://makingchatbots.com/p/cx-as-code-with-genesys-cloud
------------------------------
Lucas Woodward
Winner of Orchestrator of the Year, Developer (2025)
LinkedIn - https://www.linkedin.com/in/lucas-woodward-the-dev
Newsletter - https://makingchatbots.com
Original Message:
Sent: 07-31-2025 18:25
From: Lucas Woodward
Subject: Best source(s) of info on how to get started with CI/CD if orgs already exist?
Sorry for the slow response, and if you already know most of this. However, I thought I'd start from the high-level and work down.
Terraform at the high-level
The following diagram shows the high-level of Terraform being used to maintain the infrastructure of two organisations, Dev and Prod.
It shows two things:
- Each environment has its own state file - this records the state of the resources TF manages in the environment, which in this diagram is the
book_refund queue.
- Ideally both environments are made to represent the same resource definitions (.tf files)
- Although attributes/quantities of resources can differ between environments as the tfvars files show
The separation of state files has interesting consequences for each organisation, namely:
- If you want to import a resource you created manually in an Org into TF then you'd have to do it for each environment
- This is because TF will import the resource into your environment specific state file.
- Each environment's state file will associate the TF resource's ID (resource type + resource name) with the ID of the resource in Genesys. In the diagram this means there will be an entry in the state files linking
genesyscloud_routing_queue.book_refund to the ID of a resource in Genesys Cloud.
- If you manually rename the ID of a resource in the TF file (e.g from
.book_refund to .book_refunds) then TF destroy the resource with the old name and create a new one with the new name.
Taking control of resources you already have in Dev and Prod
If you have resources in your organisations that you want to control via Terraform then you need to import them into your Terraform's state file, and either into a TF JSON file via Genesys Cloud's Export resource or into the TF file using TF's import command.
Once the resource is managed by TF then ideally you would no longer be making changes to it directly in the UI since this can cause the resource to drift - meaning it becomes unaligned to what TF is expecting. The consequences being that TF with likely overwrite your manually set config.
This is an example of using Terraform's import functionality:
# file: queue.tf# 1. Define the import with the ID of the element and the# resource below you want it associated with in the state fileimport { to = genesyscloud_routing_queue.book_purchase id = "d3fc76d9-ff56-434a-a546-6054ca2ac8c5"}# 2. Only you run apply it will have imported the state against this resource# You can then delete the import statement above. resource "genesyscloud_routing_queue" "book_purchase" { name = "Book Purchase"}
You would have to perform this against each environment to ensure the resource in each is stored in the respective state file. In each environment the common identifier for the book_purchase queue is the ID genesyscloud_roouting_queue.book_purchase.
Referencing existing resources in your flows
You mentioned that you have flows/resources in your dev org that reference other resources in your dev org (i.e. a flow that references a queue), and you want to promote such flows into your Prod org.
Presuming the resources you've mentioned aren't managed in TF then you'll need to use a Data Source resource. These resources allow you to reference an existing resource and extract out information about it that can be used as a reference:
An example of this:
data "genesyscloud_user" "user_lucas" { name = "Lucas Woodward"}resource "genesyscloud_flow" "inbound_message_flow" { filepath = "${path.module}/book_refund_inbound_message_flow.yaml" file_content_hash = filesha256("${path.module}/book_refund_inbound_message_flow.yaml") # These reference placeholders in the flow file e.g. {{direct_agent_id}} substitutions = { direct_agent_id = data.genesyscloud_user.user_lucas.id }}
In this example I am using the data resource to 'lookup' a user with my name, which I am passing as a substitution in an Inbound Message flow.
As I promote this between Dev and Prod the Data Source will be retrieving the ID unique to that environment and passing it as a substitution.
---
Hopefully this is a good start to answering your questions?
Also, I hope you don't mind but I plan on creating a walkthrough of using TF for CX as Code in my newsletter, since I enjoyed reminding myself of all of this again.
------------------------------
Lucas Woodward
Orchestrator of the Year Finalist (2025)
LinkedIn - https://www.linkedin.com/in/lucas-woodward-the-dev
Newsletter - https://makingchatbots.com
Original Message:
Sent: 07-18-2025 14:49
From: Greg Palen
Subject: Best source(s) of info on how to get started with CI/CD if orgs already exist?
Side note: I just went and read your other posting related to the Chatbots automation. That's a great overview for me and helps me understand at a high level what I'm working towards! Thank you!
Now it's "nuts and bolts" time :).
------------------------------
Greg Palen
Principal Genesys Cloud Consultant
Verizon Business
Original Message:
Sent: 07-15-2025 07:29
From: Lucas Woodward
Subject: Best source(s) of info on how to get started with CI/CD if orgs already exist?
Hey,
I don't want to step on the toes of John or Savino, but I'm also happy answer questions. Many moons ago I wrote an article about a CI/CD flow I created, which talks to the high-level CI/CD process, but not so much to your specific situation:
Can I just check I understand your setup please?
- You have two environments (Dev and Prod) that you have manually made the same
- You want to create the TF so you can promote changes in Dev to Prod
- You have flows/resources in your dev org that reference other resources in your dev org (i.e. a flow that references a queue), and you want to promote such flows into your Prod org
- You want TF to take control of resources you already have in Dev and Prod
------------------------------
Lucas Woodward
OVO Energy Ltd
https://www.linkedin.com/in/lucas-woodward-the-dev
Original Message:
Sent: 07-09-2025 04:58
From: Greg Palen
Subject: Best source(s) of info on how to get started with CI/CD if orgs already exist?
I've spent DAYS (literally) trying to digest every article, forum post, video, etc. I can get my hands on and am left with a sense of frustration that I'm hoping I can get some help with.
Background: we started creating our first GC org/implementation roughly a year ago. At that time, we had only the one org, but had the idea that we wanted two orgs: one for "dev" and one for "prod." Due to timing requirements, the "first" org has ended up being the Prod org and the 2nd org we had set up (this was set up late last year or earlier this year) is now "Dev." I spent ~100 hours trying to basically export the majority of the objects in what is now the Prod org (the "original"/first org we had) and get them over to the "fresh" Dev org using Terraform. Long story short, some of it worked out, some of it I gave up on and manually recreated the objects.
So at least for a minute, the two orgs were basically "in sync" but I got there via a combo of Terraform and manual work (like literally have two browser windows open - one logged into Dev and one logged into Prod, and manually use the UI to create the required objects in Dev using the displayed object in Prod. What I did not/do not have is some set of Terraform files that I can use going forward for what I guess I'd call "traditional CI/CD pipeline" approach going forward.
Fast forward to today: we've been making some changes to existing flows, added a couple of new queues, added a couple of new flows, etc. in the DEV org (the "second" org that got created). Since I was not able to make Terraform do all I was hoping it would do initially, I have nothing to use in terms of Terraform files to now try to use CI/CD to "promote"/"merge" the changes made in the Dev org (manually using the UI, NOT using YAML or a code editor, etc.) and I'm entirely lost on how to get things set up in Terraform such that Terraform "understands" the relationship between a given object in the Dev org and it's "related" object in the Prod org (for example, a queue that has the exact same name in both orgs but obviously different GUID'S).
Outside of a PS engagement (it would take longer than I have to get approvals, generate PO's, etc.), I'm looking for some help on how to now get a proper set of Terraform files (.tf, state file(s) where needed, etc., tfvars, etc.) built out for both Dev and Prod such that I can then use Terraform to take the changes made manually in Dev using the UI and "push" those changes to the associated objects in Prod.
Is there a video, resource, article, etc. that walks through how to get this all set up initially given both orgs exist (I realize that is not ideal), most objects exist in both orgs, usually with the exact same name, and in general, the properties of the objects I want to manage are identical at the moment I want to get this set up?
I'm lost where it comes to the end-to-end process of setting Terraform up when both orgs and essentially all the objects already exist in both orgs and I want Terraform to understand that "Customer Service Queue" in Dev with an ID of XYZ is the "same" object as "Customer Service Queue" in Prod but with an ID of PDQ and if it detects that the properties of the Dev object (at ID = XYZ) have changed from "the initial captured state" at the point when I finish this initial setup of Terraform, it understands that it needs to apply those changes to the Prod org's object (at ID = PDQ).
I suspect this is via a combination of substitution and reference, but there's just not enough specific documentation on this specific use case (which seems to be one a LOT of people are interested in since in most cases, we'll be starting to use CX as Code with org(s) that already exist) related to how to get things set up initially assuming both orgs have been manually mangled into having a synchronized set of objects.
I believe the initial setup of all of this is going to require me to do exports from BOTH orgs (I assume into separate directories), but I don't know what Terraform files need to be copied from one directory to the other, what files I need to manually make changes to in order to be able to move forward and keep things in sync with Terraform detecting changes in the Dev org and applying those changes to the associated Prod org objects, and getting object "lookups" to properly resolve (in one case, I was trying to export a flow from one org and import it into the other. The flow had a Transfer to Group action that contained a literal with the Group name which was identical in both orgs, but after the flow got updated/imported to the destination org, I had to manually fix the transfer action literals and re-select the groups with the exact same names as what was being displayed already in Architect in the destination org.
I think there are MANY of us that would benefit from a very explicit guide on how to get the initial states captured (assuming the initial states are already in sync) and how to keep things in sync going forward.
I also want to know this: assuming I get all this set up and working, is it "allowed" to continue to use the UI (such as the Architect UI) to make changes in Dev and then use Terraform to apply those changes to Prod, or do I have to make all of my changes using a code editor and raw YAML once the initial setup is complete?
One other thing: when I did the initial export from Prod to Dev (remember, the first org we had eventually became "Prod" and the 2nd org we got created became Dev, so opposite of what you'd expect) I used ChatGPT extensively (like literally over 7 full days/100 hours). It screwed A LOT of stuff up and then would correct itself but I have to say that I would have never gotten anything to work at all without ChatGPT - the documentation that's available is just insufficient for someone new to Terraform.
I'm going to try to make my way through the Terraform in Action materials from Scott Winkler per a recommendation I saw amongst the various Genesys-created documentation elements but I can't remember where that recommendation was. I'm hoping that by gaining a deeper understanding of how Terraform handles this sort of thing overall, I'll be in a better position to understand what needs to happen related to the various Terraform files, substitutions/variables, references, dependencies, etc.
If I ever get to the point that I have it all sorted out, I absolutely will write my own guide on how I did it, so anyone who is willing to help me, please know that I'm committing to "giving back" when I've got it all sorted.
Thank you for taking the time to read all of this and also thank you in advance for (hopefully) helping me. I will be journaling/cataloging every step I take with the goal of having a final document that captures all the steps and all the gritty details of how to do this so those coming after me won't have this frustration.
Kind regards,
Greg
#CXasCode
------------------------------
Greg Palen
Principal Genesys Cloud Consultant
Verizon Business
------------------------------