Hello,
I want to exemplify one of the main conflicts we are finding when managing flows using terraform with a simple case:
Modify a flow that will depend on a new resource:
- We have a resource1 for flow1 in our configuration.
- We want to create a new resource2 for queue2 and make resource1 depends on resource2 because flow1 will transfer to queue2
- We make these changes in our configuration:
- Add resource2
- In "depends_on" field from resource1 configuration we add resource 2
- We modify flow1 YAML file so it calls queue2
- When we run terraform apply with these changes, we get an error. Terraform, before reading new dependencies, makes the "Refreshing state" action of resource1 to compare configuration with last state. When finds the modified flow1 calling a queue that does not exist (queue2 have not been created yet) it gives a "no matches" error, Archy exit code to 100.
- We think applying terraform with -refresh=false is not an option, is not a good practice and we had problems with this.
- The actual solution we found is to first create resource2 (queue2) without generating any dependencies in a first terraform run. And in a second run we create these dependencies in resource1 and modify flow1.
- This solution is not even possible when you add these dependencies in resource1 using substitutions feature and new variables in the YAML file. We would need a new resource to manage that modified flow.
In this simple case, where we only tried to change one flow, we needed to run terraform commands multiple times and change the configuration in between those runs.
In cases where we want to make a change in a flow which is called from other flows (e.g. changes at common modules or in-queue call flows or any flow that transfers to another) we would have to apply multiple and very complex changes in resources configurations while running terraform between each of them.
With my actual knowledge on this topic, this makes it very difficult to run terraform in automation through different environments without having duplicated configuration files for each environment.
If anyone is working on a similar use case and have some suggestions, it would be very helpful. Or if Genesys is working in their terraform provider with something that could solve these conflicts, it would be very useful to know about it.
Thanks for reading.
Miguel.