Legacy Dev Forum Posts

 View Only

Sign Up

Terraform and CX as code organization API error

  • 1.  Terraform and CX as code organization API error

    Posted 06-05-2025 19:26

    Smangele_Manaka | 2024-10-09 10:09:19 UTC | #1

    Hi ,

    I am encountering an issue where, whenever I run terraform apply or terraform plan, I receive the following error:

    │ Error: GET https://api./api/v2/organizations/me giving up after 21 attempt(s): Get "https://api./api/v2/organizations/me": dial tcp: lookup api.: no such host
    │
    │   with provider["registry.terraform.io/mypurecloud/genesyscloud"],
    │   on main.tf line 22, in provider "genesyscloud":
    │   22: provider "genesyscloud" {
    │
    ╵
    Releasing state lock. This may take a few moments...

    I have tried adding this block to my main.tf, but the problem still remains:

    Null resource to execute a custom API call using curl to bypass Terraform's API issues

    resource "nullresource" "customapicall" { provisioner "local-exec" { environment = { PURECLOUDENVIRONMENT = "mypurecloud.ie" # Explicitly setting the environment variable }

    Hardcoded access token for the curl command

    command = "curl -X GET https://api.mypurecloud.ie/api/v2/organizations/me -H \"Authorization: Bearer 2yNORk5Q1F#################################################################\"" } triggers = { always_run = "${timestamp()}" # Ensures this runs every time Terraform is applied } } Due to this specific error, I cannot use terraform plan or terraform apply. I would appreciate your assistance.


    charlie.conneely | 2024-10-09 22:16:18 UTC | #2

    Hello

    It looks like the provider doesn't know what domain to use in the requests. That's why "mypurecloud.ie" is missing

    Error: GET https://api./api/v2/organizations/me

    To fix this, add your region to the provider block:

    provider "genesyscloud" {
      aws_region = "eu-west-1"
    }

    Alternatively, you could set the value of awsregion using the environment variable `GENESYSCLOUDREGION`.

    You can find more info about configuring your provider here - https://registry.terraform.io/providers/MyPureCloud/genesyscloud/latest/docs.


    system | 2024-11-09 22:16:02 UTC | #3

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


    This post was migrated from the old Developer Forum.

    ref: 29776