Datadog - Failed to query available provider packages

Hi,
Am getting error “Failed to query available provider packages” if I run “terraform init” in the code repo. But its working when I have providers.tf and variables.tf in the module repo.

provider.tf file:
terraform {
required_providers {
datadog = {
source = “DataDog/datadog”
version = “>=3.8” }

}
}

Configure the Datadog provider

provider “datadog” {
api_key = var.datadog_api_key
app_key = var.datadog_app_key
validate = false
}

Main.tf file:
module “dashboard” {
source = “/dashboard/”
dashboard_name = “test dashboard mar 7”
organization_name = “XX XX”
}

Error Message:
Error: Failed to query available provider packages

│ Could not retrieve the list of available versions for provider hashicorp/datadog: provider registry
registry.terraform.io does not have a provider named Terraform Registry

│ Did you intend to use datadog/datadog? If so, you must specify that source address in each module which requires that
│ provider. To see which modules are currently depending on hashicorp/datadog, run the following command:
│ terraform providers

1 Like

I have the same issue. Wanted to use the Datadog provider in a module with for_each and this is blocking.
Anyone have ideas for a solution?

Hi, I was able to fix that by creating a symlink inside of my modules.

├── main.tf
├── backend.tf
├── folderA
│   ├── main.tf
│   ├── provider.tf (Datadog provider settings)
│   ├── folderA-1
│   │   ├── main.tf
│   │   └── provider.tf -> ../provider.tf (symlink)
├── folderB
│   ├── main.tf
│   ├── provider.tf (Datadog provider settings)
│   ├── folderB-2
│   │   ├── main.tf
│   │   └── provider.tf -> ../provider.tf (symlink)