CX as Code Exporting existing Genesys Cloud configuration

Hi Genesys Team,
Could you help me? How can I export data in hcl format? I have tried to set the variable export_as_hcl to true, but terraform tells me that variable does not exist.

my main.tf:

terraform {
  required_providers {
    genesyscloud = {
      source = "mypurecloud/genesyscloud"
      version = "~> 1.0.0"
    }
  }
}

resource "genesyscloud_tf_export" "export" {
  directory          = "./promps"
  resource_types     = ["genesyscloud_architect_user_prompt"]
  export_as_hcl = true
}

the error:

❯ .\terraform.exe plan
╷
│ Error: Unsupported argument
│
│   on main.tf line 20, in resource "genesyscloud_tf_export" "export":
│   20:   export_as_hcl = true
│
│ An argument named "export_as_hcl" is not expected here.

Where should I set this option to true?

Regards.

1 Like

Hi Javier,

Let me try it locally. The export_as_hcl feature was just being finished up and I need to check to see if I can reproduce the problem. It is an extremely new feature.

Thanks,
John Carnell
Manager, Developer Engagement

Hi Javier,

I just tried the export_as_hcl functions expected and it appears to be functioning. I would delete your .terraform.lock.hcl file and then do a terraform init to make sure pull down the latest plugin. If you still have problems please respond as I do most of my work on a mac. My suspicion is that the latest version of the plugin needs to be explicitly pulled down.

Thanks,
John Carnell
Manager, Developer Engagement

Hi @John_Carnell,
It was just what you said, I must be using a version older than 1.1.0

Thanks!

Hi Javier,

Glad it was such an easy fix. These changes just came out out so we are excited to see people play with them.

Thanks,
John

Hello @John_Carnell,
maybe a very "stupid" question, if it's possible to take this "hcl" file and import it to the other organization?

Best regards,
Yvgeni

Hi Yvgeni,

It's not a stupid question at all. The short answer is "yes, but". Whenever possible we have externalized all export data as references. However, the devil is always in the details and sometimes there are implicit relationships and ordering between APIs that do not get captured explicitly in the API interfaces.

We actually have a project team that is setting up some testing pipelines to do org exports and imports. I know that for an internal hackathon I did exactly what you are looking to. Here were the results:

  1. We found about 70% of the resources provided by Terraform were exported successfully.
  2. We ran into a number of issues with data action credentials failing to re-import because we had not realized that the credentials were not (and should not) ever be exported.

One of the biggest things to be aware of is that not all of the Genesys Cloud data objects are exposed through Terraform. This prevents you from using the tool to export and import the contents of one org into another. Right now the biggest candidates for import/export center around flows, data actions and integrations.

I would really recommend you do targeted imports and exports. If you find any issues, please let me know as as I said, I am ramping up a few resources to focus on this because I would really love to have a robust mechanism for doing exactly what you are talking about.

Thanks,
John Carnell
Manager, Developer Engagement

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