dependency lock file

The .terraform.lock.hcl file that terraform init writes to record the exact provider versions chosen and their checksums.

In more detail

Commit it, so every teammate and every pipeline gets exactly the same provider builds. The checksums make Terraform reject a provider package that has been tampered with. To take newer versions on purpose, run terraform init -upgrade and commit the changed file as its own reviewed change.

Example

provider "registry.terraform.io/hashicorp/local" {
  version     = "2.5.2"
  constraints = "~> 2.5"
  hashes      = [ "h1:...", ]
}

Related terms

Related guides

Taught in

References

Certification courses