Terraform Associate Exam QuestionsBrowse all questions from this exam

Terraform Associate Exam - Question 123


What does Terraform use .terraform.lock.hcl file for?

Show Answer
Correct Answer: A

The .terraform.lock.hcl file is used to track provider dependencies. This file is automatically generated by Terraform when you run terraform init and it locks the versions of the providers used in your configuration. This ensures that subsequent Terraform runs use the same provider versions, providing consistency and reproducibility across different environments. This file should be included in your version control system to maintain consistency across team members and environments.

Discussion

10 comments
Sign in to comment
[Removed]Option: A
Sep 2, 2023

A is correct https://www.terraform.io/language/files/dependency-lock

NunyabiznesOption: A
Mar 27, 2024

A. Tracking provider dependencies The .terraform.lock.hcl file is used to track provider dependencies and their exact versions. This file is automatically generated by Terraform when you run terraform init. It locks the versions of the providers used in your configuration, ensuring that subsequent Terraform runs use the same provider versions for consistency and reproducibility across environments. This file should be committed to your version control system to maintain consistency across team members and environments.

bora4motionOption: A
Sep 2, 2023

so if you google the first thing that shows up is A

BurakkoOption: A
Sep 1, 2023

I guess it is A. "hcl , and this name is intended to signify that it is a lock file for various items that Terraform caches in the . terraform subdirectory of your working directory. Terraform automatically creates or updates the dependency lock file each time you run the terraform init command."

shopkittyOption: D
Sep 8, 2023

I voted for D, this file for the purpose that now allow other user to perform init again the from different machine (workspace) if you work as a team.

Atta33Option: A
Oct 7, 2023

A is correct

Anderson01
Oct 24, 2023

"Terraform has made some changes to the "provider dependency" selections recorded in the .terraform.lock.hcl file. Review those changes and commit them to your version control system if they represent changes you intended to make." -> I will go with A

LivvieOption: A
Oct 30, 2023

The right answer is A. Based on this reference: https://developer.hashicorp.com/terraform/language/files/dependency-lock

Ni33Option: A
May 9, 2024

A is the correct answer !

Pikopo
Oct 2, 2024

A is correct