Interview Prep/Terraform/Dependencies, Cycles and Providers

CI on Linux fails: `the current package for registry.terraform.io/hashicorp/aws 5.72.1 doesn't match any of the checksums previously recorded in the dependency lock file`. Works on Mac laptops.

IntermediateTroubleshootingDependencies, Cycles and Providers
Answer

Likely causes → The lock file was generated on darwin_arm64 and only contains h1: hashes for that platform (when installed from a mirror/cache); CI downloads linux_amd64.

Diagnose → Count hashes: grep -A20 'hashicorp/aws' .terraform.lock.hcl.

Fix →

terraform providers lock -platform=linux_amd64 -platform=darwin_arm64 -platform=darwin_amd64 -platform=windows_amd64

Commit the updated lock file.

Prevent → Make the multi-platform providers lock command part of your upgrade script or Renovate post-upgrade task.

All Terraform questions Roadmap: Terraform

More on Dependencies, Cycles and Providers