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…
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)- A89% (16)
- B6% (1)
- D6% (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.
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.
Inspecting the Terraform state is usually done for debugging or advanced state manipulation, not as a primary step to apply configuration changes.
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.
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
Community Discussion
No community discussion yet for this question.