mariiador | 2024-04-18 13:49:12 UTC | #1
Hello all,
I asked this question already in one of the topics, but I still can not solve the problem. I need to connect Integration with pureCloudOAuthClient, but without hard coding the clientId and clientSecret. I will leave a piece of my code here and ask for help, it would be greate if some of you could help me;)
resource "genesyscloudoauthclient" "example-client" { name = "Example Data Actions Client" accesstokenvalidityseconds = 86400 authorizedgranttype = "CLIENT-CREDENTIALS" state = "active" roles { roleid = data.genesyscloudauthrole.agentrole.id divisionid = data.genesyscloudauthdivision.division.id } } data "genesyscloudauthrole" "agentrole" { name = "Master Admin" } data "genesyscloudauthdivision" "division" { name = "Home" } resource "genesyscloudintegration" "integration" { intendedstate = "ENABLED" integrationtype = "purecloud-data-actions" config { name = "Test" credentials = { pureCloudOAuthClient = genesyscloudintegrationcredential.credential.id } } } resource "genesyscloudintegrationcredential" "credential" { name = "credential" credentialtypename = "pureCloudOAuthClient" fields = { clientId = genesyscloudoauthclient.example-client.id clientSecret = genesyscloudoauthclient.example-client.clientSecret } }
I am looking forward to your replys Best regards Mariia
Syxtus_Gaal | 2024-04-19 20:01:25 UTC | #2
Hi Maria!
Not sure if that helps, but I do it like this:
- define the variable with a dummy value, eg. oauthclient_id ="xyz"in the terraform.tfvars file
- use the variable in the code:
provider "genesyscloud" {
oauthclient_id = var.oauthclient_id
oauthclient_secret = var.oauthclient_secret
aws_region = var.aws_region
sdk_debug = true
}
- Finally, the real parameter is passed at runtime:
terraform apply -var aws_region=$1 -var oauthclient_id=$2 -var oauthclient_secret=$3
Best,
Syxtus
John_Carnell | 2024-04-20 13:16:50 UTC | #3
Hi Maria,
You can also do this by setting the following environment variables:
GENESYSCLOUDOAUTHCLIENTID=MYCLIENTID GENESYSCLOUDOAUTHCLIENTSECRET=MYCLIENTSECRET GENESYSCLOUD_REGION=YOUR REGION
With these environment variables set, you do not need to set oauthclientid, oauthclientsecret, aws_region. You can find configuration information about the provider here.
Thanks, John Carnell Director, Developer Engagement
mariiador | 2024-04-29 11:04:52 UTC | #6
@SyxtusGaal @JohnCarnell, thank you so much for your answers. How I understood it is helpful with the oauth client that is already created and I am working with that, but is it also be working with the client that is only in process of creation and I am not working from it? So I need to in one-time terraform plan, apply create client and integration and take credentials from that client that is creating.
Best regards Mariia
system | 2024-05-29 09:08:06 UTC | #7
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 25795