This error occurs when Terraform cannot find a provider in the Terraform Registry. Common causes include incorrect provider source syntax, network connectivity issues, or missing required_providers declarations.
This error means Terraform attempted to install a provider from registry.terraform.io but could not locate it. This typically happens during `terraform init` when the provider source is incorrectly specified, the provider doesn't exist at that location, or Terraform cannot reach the registry. The error can be misleading because it may also indicate network issues preventing registry access.
Check your Terraform configuration for the required_providers block. The source must follow the format hostname/namespace/type. For example:
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}Common mistakes:
- Missing source argument (relies on implicit hashicorp namespace)
- Typos in provider name or namespace
- Using only the provider type without namespace
Verify that your machine can reach the Terraform Registry:
ping registry.terraform.io
curl -I https://registry.terraform.io/If the ping or curl fails:
- Check your internet connection
- Verify firewall rules aren't blocking registry.terraform.io
- If using a VPN or proxy, ensure it's properly configured
- Try switching to a public DNS server (e.g., 8.8.8.8) if using corporate DNS
Remove cached provider data and reinitialize:
rm -rf .terraform .terraform.lock.hcl
terraform initThis forces Terraform to re-download all providers from scratch and can resolve stale cache issues.
If you're migrating from an old provider path (common when upgrading from Terraform 0.12), update the state file:
terraform state replace-provider registry.terraform.io/-/aws registry.terraform.io/hashicorp/awsReplace the old and new provider addresses as appropriate for your situation.
If your environment cannot access the public registry, configure a local mirror. Create or edit ~/.terraformrc (Linux/Mac) or %APPDATA%/terraform.rc (Windows):
provider_installation {
filesystem_mirror {
path = "/usr/share/terraform/providers"
include = ["registry.terraform.io/*/*"]
}
direct {
exclude = ["registry.terraform.io/*/*"]
}
}Then place provider binaries in the specified directory following the structure: hostname/namespace/type/version/os_arch/
For Terraform versions 0.13.0 to 1.0.0, there was a DNS resolution issue on macOS/Linux related to Go's DNS client that could cause phantom provider-not-found errors even when providers exist. This was fixed in Terraform 1.0.1 and later. If you're on an older version, upgrading is recommended.
Organizations using private Terraform registries or air-gapped environments should implement a local provider mirror or run an internal registry implementing the provider registry protocol. This eliminates dependency on the public registry for provider discovery and installation.
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