Terraform Linode provider not found?
I'm trying to initialize my terraform provider to "linode" but it's not found as a provider. I suspect hashicorp changed something and the search for the provider is failing.
Initializing provider plugins...
- Finding latest version of hashicorp/linode...
2021-04-18T21:33:52.040-0700 [DEBUG] Service discovery for registry.terraform.io at https://registry.terraform.io/.well-known/terraform.json
2021-04-18T21:33:52.570-0700 [DEBUG] GET https://registry.terraform.io/v1/providers/hashicorp/linode/versions
2021-04-18T21:33:52.871-0700 [DEBUG] GET https://registry.terraform.io/v1/providers/-/linode/versions
?
? Error: Failed to query available provider packages
?
? Could not retrieve the list of available versions for provider hashicorp/linode: provider registry registry.terraform.io does not have a provider
? named registry.terraform.io/hashicorp/linode
?
? Did you intend to use linode/linode? If so, you must specify that source address in each module which requires that provider. To see which modules
? are currently depending on hashicorp/linode, run the following command:
? terraform providers
?
$ terraform providers | grep linode
??? provider[registry.terraform.io/hashicorp/linode]
My file contains
// linode-gitlab.tf -- define the gitlab linode instances
provider "linode" {
token = "$LINODE_TOKEN"
}
data "linode_region" "region" {
id = "us-east"
}
where the terraform.tvars file contains my actual token.
3 Replies
Hey there,
The latest version of Terraform Registry seems to support the syntax you used for the region data source. It looks like the latest version of the registry is "1.16.0
". According to it, one should have a code block specifying the registry version in the Terraform configuration. I'd look something like this:
terraform { required_providers { linode = { source = "linode/linode" version = "1.16.0" } } } provider "linode" { # Configuration options }
That's what seems to be recommended by HashiCorp when one clicks on the "USE PROVIDER" dropdown in the documentation link I referenced above.
If that doesn't fix the issue, you may also want to check if there are any mentions of this in HashiCorp's Terraform support community. If you find no mentions of it, you can try logging a support ticket with them, even if you're only a community user. I know there's been similar cases where doing so has helped fx this kind of issues.
Best,
Arty
Hi,
I just had the issue recently.
With Terraform 0.13+, you must specify all required providers and their respective source in your Terraform configuration. A provider source string is comprised of [hostname]/[namespace]/[name].
For me the below works.
terraform {
required_providers {
linode = {
source = "linode/linode"
}
}
}
provider "linode" {
token = var.LINODE_TOKEN
}
data "linode_profile" "me" {}
I did try to make a pull request to this documentation page https://www.linode.com/docs/guides/how-to-build-your-infrastructure-using-terraform-and-linode/
However, I was struggling to get the formatting properly. I am not sure if this is a regular markdown.
I struggled with this for a while as well < too long > I was using self hosted modules in a self-hosted gitlab server, and ended up pulling them in to use local manually to do troubleshooting, but then realized any main.tf in a module directory now requires this at the top of every module…..wathcing my console output on the ci/cd kept telling me to run terraform providers ( to see which modules) needed the provider reference, eventually dawned me to add it to my pipeline and it spat out which modules needed them. ~Bill Engval (here's your sign).
I went through and added it to any main.tf I had for modules it told it wanted/needed. Got me past the issue. Hope that helps. Cheer!
terraform {
required_providers {
linode = {
source = "linode/linode"
version = "1.16.0"
}
}
}
provider "linode" {
token = "UR_TOKEN"
}