What does the .terraform.lock.hcl file track?

Prepare for the HashiCorp Terraform Associate Exam with quizzes, flashcards, and multiple-choice questions. Each question includes hints and explanations. Boost your confidence and ace your exam!

Multiple Choice

What does the .terraform.lock.hcl file track?

Explanation:
The file .terraform.lock.hcl records the exact versions of providers that Terraform installs for your configuration, along with their checksums. When you run terraform init, Terraform resolves the providers you declare to specific versions and writes them into this lock file so future runs install the same provider versions. This ensures reproducible environments even if newer provider releases exist. It doesn’t track modules, remote state configuration, or resource IDs—the former is handled by module sources and the .terraform/modules cache, the latter by backend configuration and the state file.

The file .terraform.lock.hcl records the exact versions of providers that Terraform installs for your configuration, along with their checksums. When you run terraform init, Terraform resolves the providers you declare to specific versions and writes them into this lock file so future runs install the same provider versions. This ensures reproducible environments even if newer provider releases exist. It doesn’t track modules, remote state configuration, or resource IDs—the former is handled by module sources and the .terraform/modules cache, the latter by backend configuration and the state file.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy