Hi John,
What I've tested is the following code:
// Copyright (c) HashiCorp, Inc
// SPDX-License-Identifier: MPL-2.0
import { Construct } from "constructs";
import { App, TerraformStack } from "cdktf";
import { TfExport} from "./.gen/providers/genesyscloud/tf-export";
import { GenesyscloudProvider} from "./.gen/providers/genesyscloud/provider";
class MyStack extends TerraformStack {
constructor(scope: Construct, id: string) {
super(scope, id);
// define resources here
new GenesyscloudProvider(scope,'Provider',{
awsRegion: 'XXXXX',
oauthclientId: 'XXXXXXX',
oauthclientSecret: 'XXXXXXX'
});
new TfExport(scope,'Export',{
exportAsHcl: true,
includeStateFile: true,
directory: './fullExport'
});
}
}
const app = new App();
new MyStack(app, "genesys-cx-as-code");
app.synth();
What I get is the following terraform.tfstate file:
{
"version": 3,
"serial": 1,
"lineage": "9a206d32-095c-438d-86e3-607791f8e167",
"backend": {
"type": "local",
"config": {
"path": "/XXXXXX/terraform.genesys-cx-as-code.tfstate",
"workspace_dir": null
},
"hash": 1721479173
},
"modules": [
{
"path": [
"root"
],
"outputs": {},
"resources": {},
"depends_on": []
}
]
}
If instead of using CDK I execute the following main.tf:
terraform {
required_providers {
genesyscloud = {
source = "mypurecloud/genesyscloud"
version = "~> 1.0.0"
}
}
}
resource "genesyscloud_tf_export" "export" {
directory = "./genesyscloud"
include_state_file = true
}
provider "genesyscloud" {
oauthclient_id = "XXXXXXXX"
oauthclient_secret = "XXXXXXXXX"
aws_region = "XXXXXX"
}
Then what I get is this tfstate file:
{
"version": 4,
"terraform_version": "1.3.7",
"serial": 4,
"lineage": "cfc976a9-fda0-24f9-c081-a08ab8386421",
"outputs": {},
"resources": [
{
"mode": "managed",
"type": "genesyscloud_tf_export",
"name": "export",
"provider": "provider[\"registry.terraform.io/mypurecloud/genesyscloud\"]",
"instances": [
{
"schema_version": 0,
"attributes": {
"directory": "./genesyscloud",
"exclude_attributes": null,
"id": "genesyscloud/genesyscloud.tf.json",
"include_state_file": true,
"resource_types": null
},
"sensitive_attributes": [],
"private": "bnVsbA=="
}
]
}
],
"check_results": null
}
So this time resources are correctly produced.
I get no error on console or terminal, it just produce the files so I have no clue why when generating using the cdk resources are not produced.
Any clue?