nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-004 · Question #236

What is the purpose of the terraform.lock.hcl file in Terraform?

The correct answer is D. Tracking specific provider dependencies. The terraform.lock.hcl file is automatically created and maintained by Terraform. It records the specific versions and checksums of providers used in a configuration, ensuring consistent runs across environments and machines.

Submitted by rachelw· Apr 18, 2026Understand Terraform Providers

Question

What is the purpose of the terraform.lock.hcl file in Terraform?

Options

  • AThere is no such file.
  • BStoring references to workspaces, which are locked.
  • CPreventing Terraform runs from occurring.
  • DTracking specific provider dependencies.

How the community answered

(37 responses)
  • B
    3% (1)
  • C
    5% (2)
  • D
    92% (34)

Explanation

The terraform.lock.hcl file is automatically created and maintained by Terraform. It records the specific versions and checksums of providers used in a configuration, ensuring consistent runs across environments and machines.

Topics

#terraform.lock.hcl#provider dependencies#dependency locking#terraform init

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice