TA-002-P · Question #121
What does terrafom plan do ?
The correct answer is A. Create an execution plan by evaluating the difference between configuration file and state. The terraform plan command generates an execution plan by comparing the desired state in configuration files with the current state of infrastructure.
Question
What does terrafom plan do ?
Options
- ACreate an execution plan by evaluating the difference between configuration file and state
- BPerforms a refresh, unless explicitly disabled, and then apply the changes that are
- CCreate an execution plan by evaluating the difference between configuration file and
- DChecks whether the execution plan for a set of changes matches your expectations by
How the community answered
(32 responses)- A88% (28)
- B3% (1)
- C3% (1)
- D6% (2)
Why each option
The `terraform plan` command generates an execution plan by comparing the desired state in configuration files with the current state of infrastructure.
`terraform plan` creates an execution plan by evaluating the difference between the current infrastructure state, as recorded in the state file, and the desired state defined in the Terraform configuration files. This plan shows what actions (create, update, delete) Terraform proposes to take without actually performing them.
This describes the behavior of `terraform apply`, which performs changes after an optional refresh, not `terraform plan`.
This option is incomplete as it correctly identifies the configuration file but omits the crucial comparison with the state file.
While `terraform plan` helps in checking expectations, its primary function is to generate the detailed execution plan, not just to verify expectations.
Concept tested: `terraform plan` command functionality
Source: https://developer.hashicorp.com/terraform/cli/commands/plan
Topics
Community Discussion
No community discussion yet for this question.