How to fix provider registry registry.terraform.io does not have a provider named in Terraform
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.
Quick fix
Fixes provider registry registry.terraform.io does not have a provider named
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 5.0"
}
}
}- Verify provider source syntax
- Check network connectivity to registry
- Clear and reinitialize Terraform
- Update state file if migrating providers
terraform {required_providers {aws = {source = "hashicorp/aws"version = "~> 5.0"}}}provider registry registry.terraform.io does not have a provider named
What this error means
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.
Typical symptoms
- terraform init fails with 'does not have a provider named' message
- Terraform cannot download provider plugins
- Error appears even with valid provider configurations
- Works on some machines but fails on others (network-related)
- Fails after upgrading Terraform or changing provider versions
Common causes
- Missing or incorrect required_providers block in Terraform configuration
- Incorrect provider source address format or typo in provider name
- Network connectivity issues preventing access to registry.terraform.io
- DNS resolution problems or firewall blocking registry access
- Using legacy provider syntax without explicit source declaration (pre-0.13)
- Provider state file references outdated or non-existent provider paths
- Registry outage or service disruption
How to fix "provider registry registry.terraform.io does not have a provider named"
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/
Advanced notes
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.
Frequently asked questions
- What does "provider registry registry.terraform.io does not have a provider named" mean?
- 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.
- How do I fix "provider registry registry.terraform.io does not have a provider named"?
- 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.
- What causes "provider registry registry.terraform.io does not have a provider named"?
- Missing or incorrect required_providers block in Terraform configuration Incorrect provider source address format or typo in provider name Network connectivity issues preventing access to registry.terraform.io
- Is the "provider registry registry.terraform.io does not have a provider named" error serious?
- Yes. This is a high-severity error that usually blocks work until it is fixed, but the steps above resolve it.