What file records the exact provider versions used in a Terraform configuration to ensure reproducible builds?

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 file records the exact provider versions used in a Terraform configuration to ensure reproducible builds?

Explanation:
Terraform uses a lock file to pin the exact provider versions and their checksums for reproducible builds. The file named .terraform.lock.hcl is generated and updated by terraform init and records the specific provider versions (and their source) along with a checksum. This ensures future runs install the same provider binaries, giving consistent behavior across machines. Other files have different purposes: main.tf contains the resource and provider configuration, terraform.tfvars holds variable values, and backend.tf configures the state backend. Without the lock file or with changes to it, Terraform may resolve and fetch different provider versions, breaking reproducibility.

Terraform uses a lock file to pin the exact provider versions and their checksums for reproducible builds. The file named .terraform.lock.hcl is generated and updated by terraform init and records the specific provider versions (and their source) along with a checksum. This ensures future runs install the same provider binaries, giving consistent behavior across machines. Other files have different purposes: main.tf contains the resource and provider configuration, terraform.tfvars holds variable values, and backend.tf configures the state backend. Without the lock file or with changes to it, Terraform may resolve and fetch different provider versions, breaking reproducibility.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy