The .terraform.lock.hcl file has become out of sync with your provider requirements, typically due to platform differences or manual edits. This error prevents Terraform from proceeding until the lock file is regenerated or updated.
Terraform uses the .terraform.lock.hcl file to lock provider versions and ensure consistent deployments across your team. When this file becomes inconsistent with your provider configuration, Terraform detects a mismatch and refuses to proceed. This typically happens when the lock file was created on one platform (e.g., macOS) but is being used on another (e.g., Linux), or when the provider versions in your configuration have changed without the lock file being updated. The lock file contains provider version numbers and checksums for each platform architecture your team uses.
Remove the inconsistent lock file and let Terraform regenerate it with correct checksums:
rm .terraform.lock.hcl
terraform initThis creates a new lock file with providers for your current platform.
If your team uses multiple platforms, generate lock entries for all of them at once:
terraform providers lock -platform=linux_amd64 -platform=darwin_amd64 -platform=darwin_arm64 -platform=windows_amd64This ensures every developer and CI/CD pipeline uses the same provider versions regardless of OS.
Always commit .terraform.lock.hcl to version control:
git add .terraform.lock.hcl
git commit -m 'Regenerate Terraform lock file with all platform checksums'This ensures all team members and CI/CD systems use identical provider versions.
Have all team members run terraform init to verify they can read the lock file without errors:
terraform initIf any developer gets inconsistency errors on their platform, repeat steps 1-2 to include their platform in the lock file.
The .terraform.lock.hcl file format includes provider source, version, and a checksum (h1 hash) for each platform. Different OS/architecture combinations require different checksums because binary packages differ. When you run 'terraform providers lock' with multiple -platform flags, Terraform downloads and checksums the provider package for each platform, even if you're not currently on that platform. This is why it's important to run this command before committing to ensure all team members and CI/CD pipelines have consistent lock entries. For teams using both Intel and ARM Macs (darwin_amd64 vs darwin_arm64), including both platforms is essential. If you only included darwin_amd64 in the lock file but someone on your team uses an M1/M2 Mac (darwin_arm64), they'll get this error. Similarly, if CI/CD runs on Linux but developers use macOS, both platforms must be in the lock file.
Error: Error rendering template: template not found
How to fix "template not found" error in Terraform
Error: Error generating private key
How to fix 'Error generating private key' in Terraform
Error creating Kubernetes Service: field is immutable
How to fix "field is immutable" errors in Terraform
Error: Error creating local file: open: permission denied
How to fix "Error creating local file: permission denied" in Terraform
Error: line endings have changed from CRLF to LF
Line endings have changed from CRLF to LF in Terraform