Terraform-Associate-004 practice question 34 of 35
As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?
Full set: 360 questionsThe terraform init command is used to initialize a working directory containing Terraform configuration files. This process includes downloading and installing the necessary provider plugins. To update these plugins to the latest versions allowed by the version constraints in your configuration, you must run terraform init with the -upgrade option. This tells Terraform to check for newer provider versions and install them if they are available and compatible.
A. terraform refresh updates the state file to match real-world infrastructure; it does not manage plugin versions and has no -upgrade option.
B. terraform apply creates, updates, or destroys infrastructure based on the configuration; it does not upgrade plugins and has no -upgrade option.
D. terraform providers is a command used to display information about providers required for the current configuration; it does not perform upgrades.
1. HashiCorp Terraform Documentation, "Command: init": Under the "Provider Installation" section, it states, "To upgrade to the latest acceptable version of all providers, run terraform init -upgrade." This command respects the version constraints defined in your configuration.
2. HashiCorp Terraform Documentation, "Provider Versioning": This page explains how Terraform handles provider versions and mentions that terraform init -upgrade is the command to use for upgrading to the latest compatible versions. It notes, "You can use the -upgrade option with terraform init to have Terraform consider newer versions than those already recorded in the dependency lock file."
Keep practicing
Take the free Terraform-Associate-004 practice test
Ten exam-style questions with answers and explanations, plus the exam facts and study guides.
More questions
Other Terraform-Associate-004 practice questions
- Question 1You should run terraform fnt to rewrite all Terraform configurations within the current w…
- Question 2Module variable assignments are inherited from the parent module and you do not need to e…
- Question 3terraform validate confirms thesyntaxof Terraform files.
- Question 4Using the terraform state rm command against a resource will destroy it.
- Question 5Variables declared within a module are accessible outside of the module.
- Question 6terraform init retrieves and caches the configuration for all remote modules.
