nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-003 · Question #67

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…

The correct answer is A. Terraform will use the version recorded in your lock file. This is how Terraform chooses which version of the provider to use, when you add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The lock file records the exact version of each provider that was installed in…

Understand Terraform Basics

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

How the community answered

(52 responses)
  • A
    73% (38)
  • B
    13% (7)
  • C
    10% (5)
  • D
    4% (2)

Explanation

This is how Terraform chooses which version of the provider to use, when you add a new resource to an existing Terraform configuration, but do not update the version constraint in the configuration. The lock file records the exact version of each provider that was installed in your working directory, and ensures that Terraform will always use the same provider versions until you run terraform init - upgrade to update them.

Topics

#dependency lock file#provider versions#version constraints#.terraform.lock.hcl

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-003 Practice