HashiCorp Certified: Terraform Associate (003) — Question 9
When does Terraform create the .terraform.lock.hcl file?
Answer options
- A. After your first terraform plan.
- B. After your first terraform apply.
- C. After your first terraform init.
- D. Whenever you enable state locking.
Correct answer: C
Explanation
The .terraform.lock.hcl file is created during the terraform init command, which initializes the working directory and sets up necessary files for Terraform. The other options are incorrect because terraform plan and terraform apply do not generate this lock file, and enabling state locking does not trigger its creation.