Table of Contents

The Error

Error: Failed to install providers / Could not retrieve the list of available versions

What Causes This

Terraform init cannot download providers. Network restrictions, registry unreachable, or incorrect source address.

How to Fix It

Solution 1: Update Lock File

rm .terraform.lock.hcl
terraform init

Solution 2: Air-Gapped Install

# On connected machine:
terraform providers mirror /path/to/mirror
# Then configure filesystem_mirror in .terraformrc

Solution 3: Fix Proxy

export HTTPS_PROXY=http://proxy:8080
terraform init

Prevention Tips

  1. Pin provider versions — avoid surprise breaking changes
  2. Use CI/CD — catch errors before they hit production
  3. Test with terraform plan — always review before applying
  4. Keep Terraform updated — newer versions have better error messages
  5. Use terraform validate — catches syntax errors early

Hands-On Courses

Conclusion

This error is common and fixable. Follow the solutions above, and check our Terraform course for hands-on training that covers real-world troubleshooting scenarios.