CX as Code: "genesyscloud_flow" resource

Hi everyone,

I´m using Terraform "genesyscloud_flow" resource to publish architect flows in Genesys Cloud. And I would like to use typical archy External References and Substitutions using additional YAML files.

I tried to use an external reference with this form <file_path>#<yaml_path> and I locate my external referenced file inside my terraform directory. This is the error message i get for an Archy exit code 101:

"Exception info: invalid reference - the file path '.././references/IntentBotCases.yaml' resolved to '/var/task/https:/prod-archy-jobs.s3.amazonaws.com/archy/flows/references/IntentBotCases.yaml' which does not exist."

If anyone knows if this two features are available for "genesyscloud_flow" resource, or anyone can help me to use them, I will appreciate.

Thanks in advance.

Miguel.

1 Like

Hi @John_Carnell,
Can you help us with this question? I know that you are a terraform guru :wink:.

Thank you very much.

Hi Miguel,

Sorry about this. It appears this post had fallen through the cracks. Here is what I think is happening. The genesyscloud_flow can only process:

  1. Archy file at a time. So you can not have an external reference to another architect file and have it automatically picked up. Instead, you need to make sure that map out the file dependencies between the architect flow and upload them each individually with the appropriate depends_on in the genesyscloud_flow declarations. So if A depends on B, you have to use define 2 genesyscloud_flows resource and makes sure B depends_on explicitly.

  2. We do not currently support the Archy CLI variable substitution for substituting variables in the Archy flow. Terraform already supports variable substitution and file transformation natively and we opted to leave out the archy mechanism separately. Here is an example of where we do a variable substitution in an architect flow using terraform:

resource "local_file" "transform-message-bot-flow" {
  content = templatefile("architect-flows/templates/DudeWheresMyStuffMessage_v4-0.yaml.tftpl",
    { integration_category = module.lambda_data_action.integration_data_action_category,
  integration_data_action_name = module.lambda_data_action.integration_data_action_name })
  filename = "architect-flows/DudeWheresMyStuffMessage_v4-0.yaml"
}

Here we have two variables we are substituting here. If you look in this file you will see two variables called ${integration_category } and ${ integration_data_action_name}.

The overall project that does this work is here.

Sorry for the delay in responding to questions and please post more if you have any further questions.

Thanks,
John Carnell
Manager, Developer Engagement

Hi Miguel,

I spoke a little soon in my solution. I was reviewing my "local_file" example and am seeing some inconsistent behavior with the provider. I am going to talk with the dev ton the resource provider omorrow so please do not take #2 as the right solution just yet :).

Thanks,
John Carnell
Manager, Developer Engagement

1 Like

Thank you very much @John_Carnell for the answer!, we look forward to it!

Hi Miguel,

I just wanted to follow up with you. Per my previous email using a local_file to do variable substitution on Archy flows turned out to be problematic because Terraform builds its dependency graph and does change detection before it starts applying any changes. So the local_file resource will transform a file and inject variables, but the Archy flow will not detect that the flow has actually changes. The quick (and ugly) solution is to run Terraform twice and that will ensure that the injection of values in Archy get picked up.

My team has just finished a change that will allow for you to define variable substitution values directly in the Terraform provider. This will eliminate this problem. We should have a new version of the flow component available by sometime next week.

Thanks,
John Carnell
Manager, Developer Engagement

Thank you @John_Carnell ! We will wait and try that new feature you are talking about.

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