HashiCorp Certified: Terraform Associate (003) — Question 9

When does Terraform create the .terraform.lock.hcl file?

Answer options

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.