I keep getting this error that PERSISTED that's basically an old terraform bug Apparently my lock file is corrupted and I've tried deleting the lock file then terraform init and also deleting it with .terraform and terraform init then plan many times BUT IT WONT GO AWAY I've also tried updating my terraform cli version, (i'm using windows and I used choco install terraform and uninstall)
│ Error: Required plugins are not installed │ │ The installed provider plugins are not consistent with the packages selected in the dependency lock file: │ - registry.terraform.io/hashicorp/azurerm: the cached package for registry.terraform.io/hashicorp/azurerm 4.16.0 (in .terraform\providers) does not match any of the checksums recorded in the dependency lock file │ │ Terraform uses external plugins to integrate with a variety of different infrastructure services. To download the plugins required for this configuration, │ run: │ terraform init
It worked last time when my config was a little modified, idk what's the root cause of the error and it's driving me crazy, I tried pinning the versions and getting the most recents ones and yet I keep getting the same error, anyone going through this eroor in 2025? Terraform announced it as a bug @2022 and fixed it in newer versions. I am using v1.10.4 and I'm still encountring this error.
This was my successful attempt with it ig, maybe when the versions are to >= not >~ or exact version! I'm not sure what's causing this, and later on when trying to add my client secret and variables I got a closer error.
terraform {
required_version = ">=1.0"
required_providers {
azapi = {
source = "azure/azapi"
version = ">=2.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.0"
}
random = {
source = "hashicorp/random"
version = ">=3.0"
}
time = {
source = "hashicorp/time"
version = ">=0.9.1"
}
}
}
I keep getting this error that PERSISTED that's basically an old terraform bug Apparently my lock file is corrupted and I've tried deleting the lock file then terraform init and also deleting it with .terraform and terraform init then plan many times BUT IT WONT GO AWAY I've also tried updating my terraform cli version, (i'm using windows and I used choco install terraform and uninstall)
│ Error: Required plugins are not installed │ │ The installed provider plugins are not consistent with the packages selected in the dependency lock file: │ - registry.terraform.io/hashicorp/azurerm: the cached package for registry.terraform.io/hashicorp/azurerm 4.16.0 (in .terraform\providers) does not match any of the checksums recorded in the dependency lock file │ │ Terraform uses external plugins to integrate with a variety of different infrastructure services. To download the plugins required for this configuration, │ run: │ terraform init
It worked last time when my config was a little modified, idk what's the root cause of the error and it's driving me crazy, I tried pinning the versions and getting the most recents ones and yet I keep getting the same error, anyone going through this eroor in 2025? Terraform announced it as a bug @2022 and fixed it in newer versions. I am using v1.10.4 and I'm still encountring this error.
This was my successful attempt with it ig, maybe when the versions are to >= not >~ or exact version! I'm not sure what's causing this, and later on when trying to add my client secret and variables I got a closer error.
terraform {
required_version = ">=1.0"
required_providers {
azapi = {
source = "azure/azapi"
version = ">=2.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = ">=3.0"
}
random = {
source = "hashicorp/random"
version = ">=3.0"
}
time = {
source = "hashicorp/time"
version = ">=0.9.1"
}
}
}
Share
Improve this question
asked Jan 19 at 20:10
Rim DammakRim Dammak
211 silver badge9 bronze badges
2
|
1 Answer
Reset to default 1The installed provider plugins are not consistent with the packages selected in the dependency lock file:
The above kind of errors occurs when there is a mismatch between the dependencies recorded in Terraforms dependency lock file and the current terraform configuration you are trying to apply.
Also, try to use the exact versions (Eg: ==version
) rather than using the version ranges (>=
).
terraform {
required_version = ">=1.0"
required_providers {
azapi = {
source = "azure/azapi"
version = "2.2.0"
}
azurerm = {
source = "hashicorp/azurerm"
version = "3.0"
}
}
Basic functionality is once you run terraform init
, it generates or updates the lock file to record the exact provider versions that match your configuration’s constraints.
Terraform raises an inconsistency error if changes are made to your configuration or environment without updating the lock file, which might lead to compatibility and preventing potential misconfigurations.
One way to resolve it is by deleting the terraform.lock.hcl
file and rerun terraform init
to regenerate it.
Command: rm terraform.lock.hcl
Refer Troubleshooting dependency lock issues for more relevant information.
Alternatively, you can reinitialize Terraform to download provider binaries again freshly and create a new lock file.
The
-reconfigure
option disregards any existing configuration, preventing migration of any existing state.
terraform init -reconfigure
Reference for the same: Hashicorp Terraform
.terraform.lock.hcl
file and runningterraform init
fixes this issue. Unless there are strict provider requirements, you can try that. – Marko E Commented Jan 20 at 10:48