Terraform: Error: Inconsistent dependency lock file — provider x: required by this configuration but no version is selected
The .terraform.lock.hcl file doesn’t match the providers/versions your configuration now requires, or init wasn’t run.
Seen on:
Terraform
Meaning
Adding a provider, changing version constraints, or switching platforms (lock file only has hashes for one OS) requires terraform init -upgrade or providers lock for all platforms.
Common causes
- Provider added/changed without terraform init
- Lock file missing hashes for the CI platform (darwin vs linux)
- Version constraint changed
- .terraform directory stale
⚡ Quick fix
- Run terraform init -upgrade and commit the lock file
- Add hashes for all platforms with terraform providers lock
- Delete .terraform/ and init again
Detailed fix by platform
Shell
- hcl
terraform init -upgrade terraform providers lock -platform=linux_amd64 -platform=darwin_arm64 -platform=windows_amd64
How to diagnose
- Lock — Providers listed
- Platforms — Hashes for CI OS?
- Init — Run after change?
🔧 Still not fixed?
Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:
Similar errors
Other ways to find it
🧠 Still stuck? Analyze your error
Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 7 Oct 2026