nerdexam
HashiCorpHashiCorp

TERRAFORM-ASSOCIATE-004 · Question #67

TERRAFORM-ASSOCIATE-004 Question #67: Real Exam Question with Answer & Explanation

The correct answer is A: Terraform will use the version recorded in your lock file. When a .terraform.lock.hcl (dependency lock file) is present, Terraform uses the provider version recorded in that file for all resources, including newly added ones. The lock file pins provider versions to ensure consistent, reproducible runs across different machines and team m

Submitted by kavita_s· Apr 18, 2026Understand Terraform Providers

Question

You add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The existing and new resources use the same provider. The working contains a .terraform.lock, hc1 file. How will Terraform choose which version of the provider to use?

Options

  • ATerraform will use the version recorded in your lock file
  • BTerraform will use the latest version of the provider for the new resource and the version recorded
  • CTerraform will check your state file to determine the provider version to use
  • DTerraform will use the latest version of the provider available at the time you provision your new

Explanation

When a .terraform.lock.hcl (dependency lock file) is present, Terraform uses the provider version recorded in that file for all resources, including newly added ones. The lock file pins provider versions to ensure consistent, reproducible runs across different machines and team members. Terraform will not download a newer version of the provider unless you explicitly run terraform init -upgrade. Since both the existing and new resources use the same provider, the lock file version applies uniformly.

Topics

#Provider versioning#Dependency locking#.terraform.lock.hcl#Terraform init

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 PracticeBrowse All TERRAFORM-ASSOCIATE-004 Questions