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…
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)- A73% (38)
- B13% (7)
- C10% (5)
- D4% (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
Community Discussion
No community discussion yet for this question.