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
------------------------------