nerdexam
HashiCorp

TA-002-P · Question #381

As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?

The correct answer is D. terreformn lnit -upgrade. To update Terraform provider plugins to their latest compatible versions, the terraform init -upgrade command should be used.

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

Question

As a developer, you want to ensure your plugins are up to date with the latest versions. Which Terraform command should you use?

Options

  • Aterreform providers- upgrade
  • Bterreform apply -upgrade
  • Cterreform refresh -upgrade
  • Dterreformn lnit -upgrade

How the community answered

(24 responses)
  • A
    8% (2)
  • B
    4% (1)
  • D
    88% (21)

Why each option

To update Terraform provider plugins to their latest compatible versions, the `terraform init -upgrade` command should be used.

Aterreform providers- upgrade

There is no standard terraform providers-upgrade command.

Bterreform apply -upgrade

terraform apply applies changes to infrastructure and does not handle updating provider plugins.

Cterreform refresh -upgrade

terraform refresh updates the state file to reflect the real-world infrastructure but does not upgrade provider plugins.

Dterreformn lnit -upgradeCorrect

The terraform init -upgrade command checks for and downloads the latest available versions of provider plugins configured in the Terraform code, ensuring that plugins are up-to-date within the specified version constraints. This command is responsible for initializing the working directory, which includes managing plugins.

Concept tested: Terraform plugin update command

Source: https://developer.hashicorp.com/terraform/cli/commands/init

Topics

#Terraform CLI#terraform init#Plugin updates#Provider management

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice