The "Failed to install provider" error occurs when Terraform cannot download or verify provider plugins. Common causes include lock file checksum mismatches, network connectivity issues, outdated provider references, or corrupted plugin caches.
Terraform providers are plugins that enable interaction with cloud platforms, APIs, and services. When you run "terraform init", Terraform downloads these providers from the Terraform Registry. The "Failed to install provider" error means Terraform encountered a problem during this download or verification process. This can happen for several reasons: the lock file contains invalid checksums for your platform, the network cannot reach the registry, the provider reference is outdated or incorrect, or the local plugin cache is corrupted.
The most common cause is a lock file with incomplete checksums. Remove it and regenerate:
rm .terraform.lock.hcl
terraform initIf you need to support multiple platforms (macOS, Linux, Windows):
terraform providers lock -platform=linux_amd64 -platform=darwin_amd64 -platform=windows_amd64This generates a lock file with all platform checksums.
Verify your required_providers block has correct, current namespace. Some providers changed namespaces:
terraform {
required_providers {
aws = {
source = "hashicorp/aws" # Correct namespace
version = "~> 5.0"
}
}
}Look for deprecated references like:
- terraform-providers/aws → use hashicorp/aws
- databrickslabs/databricks → use databricks/databricks
Update all .tf files to use current provider namespaces.
Check that you can reach the Terraform Registry:
curl -I https://registry.terraform.io
wget --spider https://registry.terraform.ioIf these fail, you have a network problem:
- Check your internet connection
- Verify firewall rules allow outbound HTTPS
- If behind a corporate proxy, configure Terraform to use it
- Check DNS resolution: nslookup registry.terraform.io
Delete the .terraform directory and reinitialize:
rm -rf .terraform
terraform initThis forces Terraform to re-download all providers fresh, which can fix corruption from interrupted downloads.
Ensure all team members use the same Terraform version:
terraform versionAfter upgrading Terraform (especially from 0.13 to 0.14+), regenerate the lock file:
rm .terraform.lock.hcl
terraform initIf upgrading caused the issue, also verify you don't have a state file from a newer Terraform version.
For third-party or custom providers, verify the binary exists:
terraform providersThis lists all required providers and their locations. If a provider is missing, check:
- Is the provider published to the registry?
- Is it available for your OS (linux_amd64, darwin_amd64, etc.)?
- For custom providers, is the plugin correctly placed in ~/.terraform.d/plugins/?
For CI/CD environments, ensure the lock file is committed to version control with all platform checksums. If running on different platforms, use "terraform providers lock" with all target platforms. For offline environments, pre-download providers and use provider_installation blocks to specify local paths. When using HCP Terraform or Terraform Enterprise, provider downloads happen on the remote system - ensure it can reach registry.terraform.io. For custom/private providers, configure provider installation sources in the CLI config to point to your internal registry.
Error: Error installing helm release: cannot re-use a name that is still in use
How to fix "release name in use" error in Terraform with Helm
Error: Error creating GKE Cluster: BadRequest
BadRequest error creating GKE cluster in Terraform
Error: External program failed to produce valid JSON
External program failed to produce valid JSON
Error: Unsupported argument in child module call
How to fix "Unsupported argument in child module call" in Terraform
Error: network is unreachable
How to fix "network is unreachable" in Terraform