Skill 2.1.3
The dependency lock file and upgrades
Key Concepts
The dependency lock file lists, for each provider, the exact version selected, the constraints that applied and checksums (hashes) of the provider packages. On later runs of terraform init, Terraform installs the recorded version even if a newer one satisfies the constraints, and it verifies the package against the checksums. Commit the lock file to version control so that teammates and pipelines use identical provider versions.
To move to newer versions within the constraints, run terraform init -upgrade, which updates the lock file. If the lock file must work on other operating systems, terraform providers lock -platform=linux_amd64 -platform=darwin_arm64 adds checksums for those platforms. The lock file covers providers only; module versions are controlled by version constraints in the configuration.