nerdexam
HashiCorp

TA-002-P · Question #86

You just scaled your VM infrastructure and realized you set the count variable to the wrong value. You correct the value and save your change. What do you do next to make your infrastructure match…

The correct answer is A. Run an apply and confirm the planned changes. After correcting a configuration value, the next step to update the infrastructure is to run terraform apply. This command will first generate a plan of changes based on the updated configuration and then prompt for confirmation to execute those changes, aligning the…

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

Question

You just scaled your VM infrastructure and realized you set the count variable to the wrong value. You correct the value and save your change. What do you do next to make your infrastructure match your configuration?

Options

  • ARun an apply and confirm the planned changes
  • BInspect your Terraform state because you want to change it
  • CReinitialize because your configuration has changed
  • DInspect all Terraform outputs to make sure they are correct

How the community answered

(18 responses)
  • A
    89% (16)
  • B
    6% (1)
  • D
    6% (1)

Why each option

After correcting a configuration value, the next step to update the infrastructure is to run `terraform apply`. This command will first generate a plan of changes based on the updated configuration and then prompt for confirmation to execute those changes, aligning the infrastructure with the desired state.

ARun an apply and confirm the planned changesCorrect

After correcting a configuration value, running `terraform apply` is the direct command to reconcile the infrastructure with the desired state defined in the configuration. It will calculate the necessary changes (plan) and then, upon user confirmation, execute them to adjust the VM count.

BInspect your Terraform state because you want to change it

Inspecting the Terraform state is usually done for debugging or advanced state manipulation, not as a primary step to apply configuration changes.

CReinitialize because your configuration has changed

Reinitializing (`terraform init`) is only needed when providers, modules, or backend configurations are added or changed, not typically for simple value changes like a `count` variable.

DInspect all Terraform outputs to make sure they are correct

Inspecting Terraform outputs is done to retrieve information about the deployed infrastructure, not to initiate or apply changes to it.

Concept tested: Applying configuration changes in Terraform

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

Topics

#Terraform CLI#Outputs#Configuration Changes#Verification

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice