Connect Data Action and Integration not with id through Terraform

Hello all;)

Need a small help from you, I will give you an example to understand better what I need.
I am in the process of creating a Data Action in Genesys Cloud through Terraform, and this Action has to be a part of chosen Integration, so I was wondering, if it is possible to connect this Integration to Action not with the id, but for example with the name?
Example:

resource "genesyscloud_integration_action" "example-action" {
  name                   = "Example Action"
  category               = "Genesys Cloud Data Action"
  **integration_id         = genesyscloud_integration.example_integ.id**

I hope you will understand my problem, I am looking forward to any help.

Best regards
Mariia

Hi @mariiador

You have to provide the ID of the integration to the data action. However, you can lookup the ID of the integration by providing the name to a data source. Here is an example:

resource "genesyscloud_integration_action" "action" {
  name           = "Example Action"
  category       = "Genesys Cloud Data Action"
  integration_id = data.genesyscloud_integration.integration.id

data "genesyscloud_integration" "integration" {
  name = "example integration name"
}

In this way, you only have to know the integration name. You don't have to know the ID or manage the integration under Terraform.

Hope this helps
-Charlie

Hey Charlie,

thank you so much for your fast reply!

So this:
data "genesyscloud_integration" "integration" {
name = "example integration name"
}
is creating a new Integration or just gives me possibility to use the name for connecting?

Best regards
Mariia

The latter. It takes the name and searches through all the existing integrations in the org to find a match. If it finds a match, then it returns the ID of that integration. That is the purpose of data sources in Terraform - to use a unique identifier (name in this case, but it could even be a combination of other fields) to find the object and expose its GUID.

Ah, okay, I understand now.
Thank you so much for your help!

Best regards
Mariia

1 Like