Terraform cannot find provider
Hi I'm trying to create a basic linode with terraform but keep getting this error
│ Error: Failed to load plugin schemas
│
│ Error while loading schemas for plugin components: Failed to obtain provider schema: Could not load the schema
│ for provider registry.terraform.io/linode/linode: failed to retrieve schema from provider
│ "registry.terraform.io/linode/linode": Plugin did not respond: The plugin encountered an error, and failed to
│ respond to the plugin.(*GRPCProvider).GetProviderSchema call. The plugin logs may contain more details…
╵
Here is my code
terraform {
required_providers {
linode = {
source = "linode/linode"
version = "2.9.3"
api_version = "v4beta"
}
}
}
Configure the Provider
provider "linode"{
token = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
}
Create a Linode
resource "linode_instance" "Plex-Terraform-eu-west" {
image = "linode/debian11"
label = "eu-west"
group = "Media-Server"
region = "eu-west"
type = "g6-standard-1"
root_password = "XXXXXXXXXXXXXX"
}
4 Replies
✓ Best Answer
It appears that Terraform is encountering an issue related to the provider section. Interestingly, the link provided in the error (http://registry.terraform.io/linode/linode) is resulting in a 404 error.
Out of curiosity, may I inquire about the version of Terraform you're using? You can grab this info by running terraform -version
.
terraform -version
Terraform v1.6.2
on linux_amd64
+ provider registry.terraform.io/linode/linode v2.9.3
I made an effort to reproduce this error, but I didn't encounter it while using Terraform v1.6.2 and Linode Provider v2.9.3. Here's my .tf
deployment file:
terraform {
required_providers {
linode = {
source = "linode/linode"
version = "2.9.3"
}
}
}
provider "linode" {
token = "API_TOKEN"
}
resource "linode_instance" "terraform-comm" {
image = "linode/debian11"
label = "Terraform-Comm-Example"
group = "Terraform"
region = "eu-west"
type = "g6-standard-1"
root_pass = "ROOT_PASSWORD"
}
I used this Linode guide to quickly install and configure Terraform:
Terraform's docs are another great resource for additional troubleshooting and learning:
Thank you for the information. When I review my previous attempt at replication, it becomes evident that the only missing component was the api_version = "v4beta"
environment variable. Curiously, I incorporated the api_version = "v4beta"
into the terraform block within my .tf
file, as shared above. To my surprise, immediately upon executing terraform init
, I encountered an error:
Error: Invalid required_providers object
on linode-terraform-web.tf line 6, in terraform:
6: api_version = "v4beta"
required_providers objects can only contain "version," "source," and "configuration_aliases" attributes. To configure a provider, use a "provider" block.
This issue was resolved by relocating the api_version
environment variable to the provider block.
terraform {
required_providers {
linode = {
source = "linode/linode"
version = "2.9.3"
}
}
}
provider "linode" {
token = "API_TOKEN"
api_version = "v4beta"
}
resource "linode_instance" "terraform-comm" {
image = "linode/debian11"
label = "Terraform-Comm-Example"
group = "Terraform"
region = "eu-west"
type = "g6-standard-1"
root_pass = "ROOT_PASSWORD"
}
It's worth noting that this error differs from the provider schema problem we're currently addressing. Therefore, I decided to conduct some research (which I probably should have done initially). In the process, I stumbled upon your Reddit post! This particular resource seems promising:
Terraform Gives errors Failed to load plugin schemas | Stack Overflow
I'd like to emphasize that all my testing was conducted on a freshly installed Linode instance with the latest version of Terraform (which I spun up and installed specifically for this testing). As a result, I did not encounter any caching issues on my end. It might be worthwhile to try the same approach. If it works for you, it could indicate that the root cause is related to VSCode, the plugin (if applicable), or a local caching issue.