How can i use terraform only to overwrite and dont create

Hello, I want to use CX as Code to export a queue from one environment and import it into another, but with all its dependencies, like wrap-up codes. The problem is that if the queue already exists in the target environment with some of the wrap-up codes, Terraform won't allow it because it only knows how to create. So, I’m looking for a way to update only the new elements and not the ones already present in the target environment.

For you to be able to update the resource in your target environment, Terraform needs to know the resource exists and manage it, so the resource needs to be in your state file. Depending on your setup, you could create a resource for the queue and it's dependancies with your desired settings, then export the resource including the state file, and move the resource from the source state file to the resource address in your state file. Then when you run terraform apply, it will update the resource with the config you have specified in your configuration file.

How can i import all the sources on the environment to my tfstate? Im trying with a program named terraformer but maybe you know a better option:S

Hi, you can use the genesyscloud_tf_export resource to export all resources in your org. There are options to export as HCL and also to include the state file. Once exported you can move resources between the source state (exported) and the destination state. Here is a link to the documentation Genesys TF Export

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