Terraform "Backend initialization failed" / "Module not found" — how do you fix these?
Quick Answer
Backend init failure means the state backend (S3/GCS/Azure) is unreachable or credentials/permissions are wrong — run terraform init after fixing access. Module not found means a bad module source or version — fix the source path/registry ref and re-run terraform init.
Detailed Answer
Backend errors: check the bucket/container exists, the credentials and IAM permissions are correct, and network access to the backend — then terraform init. Module errors: verify the module source (local path, Git URL, or registry address) and the pinned version, ensure you can reach the registry/Git, and run terraform init to download it. Both are resolved at init time, not plan/apply.
Code Example
terraform init -reconfigure terraform init -upgrade # refresh module/provider versions
Interview Tip
Both are init-time problems — mention terraform init (with -reconfigure/-upgrade) as the resolution step.