TA-002-P · Question #4
What is the workflow for deploying new infrastructure with Terraform?
The correct answer is C. terraform plan to import the current infrastructure to the state file, make code changes,. The standard Terraform workflow for deploying new infrastructure involves writing configuration, initializing the working directory, reviewing proposed changes, and then applying them.
Question
What is the workflow for deploying new infrastructure with Terraform?
Options
- Aterraform plan to import the current infrastructure to the state file, make code changes,
- BWrite a Terraform configuration, run terraform show to view proposed changes, and
- Cterraform plan to import the current infrastructure to the state file, make code changes,
- DWrite a Terraform configuration, run terraform init, run terraform plan to view planned
How the community answered
(29 responses)- A3% (1)
- B3% (1)
- C86% (25)
- D7% (2)
Why each option
The standard Terraform workflow for deploying new infrastructure involves writing configuration, initializing the working directory, reviewing proposed changes, and then applying them.
`terraform plan` does not import infrastructure into the state file; `terraform import` is used for that purpose.
`terraform show` displays the current state or plan file content, not proposed changes from raw configuration; `terraform plan` is used to view proposed changes.
The correct workflow starts by writing Terraform configuration files, then `terraform init` initializes the backend and plugins, `terraform plan` shows what changes will be applied, and finally `terraform apply` executes those changes to create the infrastructure.
This option is incomplete as it misses the `terraform apply` step, which is crucial for actually deploying the planned infrastructure changes.
Concept tested: Terraform standard deployment workflow
Source: https://developer.hashicorp.com/terraform/intro/core-workflow
Topics
Community Discussion
No community discussion yet for this question.