nerdexam
HashiCorp

TA-002-P · Question #443

You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?

The correct answer is B. Run terraform init -upgrade. terraform init is the command responsible for downloading and installing providers specified in your configuration. The -upgrade flag tells Terraform to upgrade providers (and modules) to the newest allowed version based on your version constraints, even if a cached version alrea

Use the Terraform CLI (terraform plan, apply, destroy, fmt, init, validate, workspace, import, taint, providers, output)

Question

You just upgraded the version of a provider in an existing Terraform project. What do you need to do to install the new provider?

Options

  • ARun terraform apply -upgrade
  • BRun terraform init -upgrade
  • CRun terraform refresh
  • DUpgrade your version of Terraform

How the community answered

(26 responses)
  • B
    96% (25)
  • D
    4% (1)

Explanation

terraform init is the command responsible for downloading and installing providers specified in your configuration. The -upgrade flag tells Terraform to upgrade providers (and modules) to the newest allowed version based on your version constraints, even if a cached version already exists in the .terraform directory. Without -upgrade, terraform init may reuse the already-downloaded version. Running terraform apply -upgrade is not a valid flag combination, terraform refresh only reconciles state, and upgrading Terraform itself is separate from upgrading providers.

Topics

#Terraform CLI#Providers#terraform init#Version Management

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice