I have a terraform project that I'm working on that I wanted to do automated testing against.
Locally, the testing framework works fine but it's failing on my build/test server.
I have checked and order of events on the server are:
- Check if the terraform folder and lock file exist, they don't
- Run terraform init on 'default' workspace
- Check if the terraform folder and lock file exist, they do
- Swap terraform workspaces to my intended workspace and run init again
- Build a custom tfvars file
- Run apply on the workspace with the var file
The error I'm getting is:
[31mâ•·[0m[0m
[31m│[0m [0m[1m[31mError: [0m[0m[1mFailed to load plugin schemas[0m
[31m│[0m [0m
[31m│[0m [0m[0mError while loading schemas for plugin components: 2 problems:
[31m│[0m [0m
[31m│[0m [0m- Failed to obtain provider schema: Could not load the schema for provider
[31m│[0m [0mregistry.terraform.io/hashicorp/aws: failed to instantiate provider
[31m│[0m [0m"registry.terraform.io/hashicorp/aws" to obtain schema: Unrecognized remote
[31m│[0m [0mplugin message:
[31m│[0m [0m
[31m│[0m [0mThis usually means that the plugin is either invalid or simply
[31m│[0m [0mneeds to be recompiled to support the latest protocol..
[31m│[0m [0m- Failed to obtain provider schema: Could not load the schema for provider
[31m│[0m [0mregistry.terraform.io/hashicorp/azurerm: failed to instantiate provider
[31m│[0m [0m"registry.terraform.io/hashicorp/azurerm" to obtain schema: Unrecognized
[31m│[0m [0mremote plugin message:
[31m│[0m [0m
[31m│[0m [0mThis usually means that the plugin is either invalid or simply
[31m│[0m [0mneeds to be recompiled to support the latest protocol...
[31m╵[0m[0m
Both Error: Failed to load plugin schemas | Azure | Terraform and Terraform Error: Failed to load plugin schemas say to remove the old terraform folder but in this case it doesn't exist prior to the init
I have tried using -upgrade
and -reconfigure
in the init as well as check if the terraform files exist prior to the init.
I don't understand why I'm getting this failure during the apply stage.
.terraform/providers
and after all of the nested directories you will find executable files with name prefixes liketerraform-provider-aws
.