terraform
dependency_error
ai_generated
true
Error: Failed to install provider: the lock file is out of date
ID: terraform/tf-dependency-lock-error
92%Fix Rate
93%Confidence
80Evidence
2023-01-01First Seen
Version Compatibility
| Version | Status | Introduced | Deprecated | Notes |
|---|---|---|---|---|
| 1 | active | — | — | — |
Root Cause
The .terraform.lock.hcl file does not match the required provider versions or platforms.
genericWorkarounds
-
92% success Run terraform init -upgrade to update the lock file with new provider versions
terraform init -upgrade updates provider versions and regenerates the lock file
Sources: https://developer.hashicorp.com/terraform/cli/commands/init
-
85% success Add platform hashes for cross-platform teams using terraform providers lock
terraform providers lock -platform=linux_amd64 -platform=darwin_amd64 -platform=darwin_arm64
Sources: https://developer.hashicorp.com/terraform/cli/commands/providers/lock
Dead Ends
Common approaches that don't work:
-
Delete .terraform.lock.hcl and never commit it
70% fail
The lock file ensures reproducible builds; without it, different team members get different provider versions
-
Manually edit the lock file hash values
85% fail
Manual hash edits are error-prone and may introduce security risks by accepting untrusted providers
Error Chain
Leads to:
Frequently confused with: