We are consolidating our outbound campaign logic using the CX-as-Code Terraform provider to reduce state drift across environments. The goal is to define a single “Common Module” flow that handles IVR validation, which can be invoked by multiple inbound call flows.
I am using the genesyscloud_flow resource to define the main flow and attempting to trigger the sub-flow using a Flow action type within the routing configuration. The documentation suggests passing the target flow ID in the action block.
Here is the Terraform configuration for the action:
resource "genesyscloud_flow" "inbound_main" {
name = "Inbound Sales Main"
flow_type = "voice"
# ... other config ...
action {
type = "Flow"
label = "Invoke Common Validation"
action {
key = "flowId"
value = "${genesyscloud_flow.common_validation.id}"
}
}
}
When I apply this, the Terraform state updates successfully. However, when the flow executes in Genesys Cloud, the interaction drops immediately. Checking the interaction logs via the Conversations API (GET /api/v2/conversations/voice/{conversationId}), I see the flow terminates with an internal error.
If I try to debug this by making a direct HTTP request to the Flow API to validate the JSON structure before pushing it through Terraform, I construct the payload like this:
{
"type": "Flow",
"action": {
"flowId": "12345-67890-abcde"
}
}
Posting this to the Flow definition endpoint returns a 400 Bad Request with the message “Invalid action configuration for Flow type.” It seems the action key inside the Flow type is not accepting the flowId as a simple string value in the JSON payload, or perhaps the structure requires a different nesting level for the action property.
I have verified the flow ID is correct and the user running the API call has the flow:read and flow:write permissions. The sub-flow itself is active and has no errors when run standalone.
Is there a specific JSON schema requirement for invoking a Flow action that differs from the standard key-value pairs used for Data or Set actions? I cannot find a working example in the Terraform provider docs for this specific action type.