terraform-provider-datadog: Terraform is not able to find the desired provider for datadog. Could not retrieve the list of available versions for provider hashicorp/datadog: provider registry registry.terraform.io does not have a provider named registry.terraform.io/hashicorp/datadog
Hi there,
Thank you for opening an issue. Please note that we try to keep the Terraform issue tracker reserved for bug reports and feature requests. For general usage questions, please see https://www.terraform.io/community.html.
Terraform Version - 0.14.0 & datadog version is 3.10.0
Affected Resource(s)
Please list the resources as a list, for example:
- datadog_synthetics_test
If this issue appears to affect multiple resources, it may be an issue with Terraform’s core, so please mention this.
Terraform Configuration Files
resource “datadog_synthetics_test” “test_api” { type = “api” subtype = “http” request_definition { method = “GET” url = “https://www.example.org” } request_headers = { Content-Type = “application/json” Authentication = “Token: 1234566789” } assertion { type = “statusCode” operator = “is” target = “200” } locations = [“aws:eu-central-1”] options_list { tick_every = 900
retry {
count = 2
interval = 300
}
monitor_options {
renotify_interval = 100
}
} name = “An API test on example.org” message = “Notify @pagerduty” tags = [“foo:bar”, “foo”, “env:test”]
status = “live” }
# Copy-paste your Terraform configurations here - for large Terraform configs,
# please use a service like Dropbox and share a link to the ZIP file. For
# security, you can also encrypt the files using our GPG public key.
Debug Output
Please provide a link to a GitHub Gist containing the complete debug output: https://www.terraform.io/docs/internals/debugging.html. Please do NOT paste the debug output in the issue; just paste a link to the Gist.
Panic Output
If Terraform produced a panic, please provide a link to a GitHub Gist containing the output of the crash.log.
Expected Behavior
What should have happened?
Actual Behavior
What actually happened?
Steps to Reproduce
Please list the steps required to reproduce the issue, for example:
terraform init
Important Factoids
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 28 (10 by maintainers)
I also have this problem. Had datadog provider specified in the root module:
terraform { required_providers { datadog = { source = "DataDog/datadog" } aws = { source = "hashicorp/aws" } } }Was working ok, then decided to split some of the datadog resources out into a module at which point tf init threw out the above error. I worked around this by declaring the provider in the child module. According to the documentation the declaration in the root module should be inherited implicitly by the child. https://www.terraform.io/language/modules/develop/providers I’m not sure why it’s necessary to declare it again.For me, the solution was simple but not obvious.
At first, the initialisation fails, but it’s a physical configuration problem in your terraform code. In my case, commenting out the whole datadog module section and defining an empty one confirmed it’s an issue with the code itself.
What I did wrong: I loaded the datadog resources inside my “local datadog” module. Then used this local module within the project. I forgot to add the “terraform provider” section inside the local module. I did it just on the project root directory.
Adding the provider section to my module sorted out the issue.
The provider needs to be defined inside your local source.
It’s a configuration problem, generally it happens when you have several modules.
I just went through this annoying quirk with the interaction between
terraformandterragruntfor therequired_providersblock specifically in theterraform {}block.Here’s what I came up with:
In the root, I have terragrunt generate a
required_providers_override.tffile with the following content:Note: The name of this file is important. Files named
*_override.tfare processed and merged last whenterraformis invoked. See:Then, in each module I have a
terraform.tffile written that also declares arequired_providers.tfblock:Here’s the final directory structure:
What this looks like to terraform:
Now both
terraformandterragruntare happy.Terraform can see in each module a
terraform.tfwith contentsterraform { required_providers { ... } }where theDataDog/datadogprovider path is properly written. Terragrunt is happy because it generates theterragrunt_required_providers_override.tffile which is used (and processed/merged last) whenterragrunt planand other commands are invoked.I seriously hope this helps someone else.