Unable to pull artifacts from a private registry while executing plan on terraform enterprise instance

Problem:

  • We have a terraform artifact in our private (JFrog) registry.
  • To access this registry we need a token
  • I am able to run tf plan for the given terraform file (This is a local execution of terrafrom plan)

main.tf file for local execution

terraform {
  required_providers {
    btp = {
      source  = "common.repositories.cloud.sap/sap/btp"
      version = "~> 0.2"
    }
  }
}

# Configure the BTP Provider
provider "btp" {
  account = "account_name"
}

  • I am unable to run terraform plan when I run a plan on the tfe cluster from my local tf command line tool. (This error does not occur when I run plan in the local execution)
terraform {
  cloud {
    hostname     = "tfe-dev.multicloud.int.sap"
    organization = "sap-graph"

    workspaces {
      name = "demo-shardul"
    }
  }

  required_providers {
    btp = {
      source  = "common.repositories.cloud.sap/sap/btp"
      version = "~> 0.2"
    }
  }

}

# Configure the BTP Provider
provider "btp" {
  globalaccount = "account_name"
}
  • The error is
Initializing Terraform Cloud...

Initializing provider plugins...
- Reusing previous version of common.repositories.cloud.sap/sap/btp from the dependency lock file
╷
│ Error: Invalid provider registry host
│ 
│ The host "common.repositories.cloud.sap" given in in provider source
│ address "common.repositories.cloud.sap/sap/btp" does not offer a Terraform
│ provider registry.
╵
The Config files used

.terraformrc file

provider_installation {
    direct {
        exclude = ["common.repositories.cloud.sap/*/*"]
    }
    network_mirror {
        url = "https://common.repositories.cloud.sap/artifactory/api/terraform/cloud-orchestration-tf/providers/"
    }
}

terraform.d/credentials.tfrc.json file

{
  "credentials": {
      "common.repositories.cloud.sap": {
        "token": "token"
      },
      "tfe-dev.multicloud.int.sap": {
        "token": "token"
      }
  }
}
  • I think that the problem is that the remote execution cannot use the configuration that I have on my local.
  • How do I resolve this