Registry unreachable — cannot download provider or module
Failed to request access to registry.terraform.io
Focused incident mode — strips away everything but this runbook.
Symptoms
- Failed to request access to registry.terraform.io
- Error: Unable to locate package for provider
- terraform init fails with connection timeout to registry
Evidence to grab
Collect these artifacts before you change anything — they prove (or rule out) each cause.
Init error output
terraform init 2>&1 | tail -20Network connectivity test
curl -sI https://registry.terraform.io | head -5
Diagnostic flow
Run the steps in order, marking each claim confirmed or refuted. The evidence you gather feeds the ranked causes below.
Guided decision tree is ready.
Steps with commands, expected output, and pass/fail branches.
Ranked root causes
Evidence checklist
- curl works but terraform init times out
- HTTPS_PROXY is not set or is wrong
- TLS certificate from proxy MITM is not trusted
Confirm before fixing
curl -sI https://registry.terraform.io --proxy <PROXY-URL>Test via the proxy
Fix
export HTTPS_PROXY=<PROXY-URL> && export SSL_CERT_FILE=<CA-BUNDLE> && terraform initSet proxy and CA cert for Terraform
Resolution runbook
Apply from top to bottom after the cause is confirmed. Review every command before running it — risk tags are shown on each.
curl -sI https://registry.terraform.ioTest basic registry connectivity
env | grep -iE 'http_proxy|https_proxy'Check proxy settings
export HTTPS_PROXY=<PROXY-URL> && export SSL_CERT_FILE=<CA-BUNDLE>Configure proxy and TLS for corporate networks
terraform initRe-run init with correct proxy settings
Prevention
- Document proxy settings and CA bundle requirements for the team.
- Use terraform providers mirror for air-gapped environments.
- Pre-download providers in CI and cache them for offline use.
- Test terraform init in the same network environment as production CI.
Related runbooks
Same stack, same failure family — worth a skim.
Backend initialization required: please run "terraform init"
Error: resource <type> requires version X.Y.Z but provider only has version A.B.C
Commands marked READ CHANGE DESTRUCTIVE — never run DESTRUCTIVE commands against production data you cannot restore. Copy → verify → execute.