nerdexam
HashiCorp

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.

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

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)
  • A
    3% (1)
  • B
    3% (1)
  • C
    86% (25)
  • D
    7% (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.

Aterraform plan to import the current infrastructure to the state file, make code changes,

`terraform plan` does not import infrastructure into the state file; `terraform import` is used for that purpose.

BWrite a Terraform configuration, run terraform show to view proposed changes, and

`terraform show` displays the current state or plan file content, not proposed changes from raw configuration; `terraform plan` is used to view proposed changes.

Cterraform plan to import the current infrastructure to the state file, make code changes,Correct

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.

DWrite a Terraform configuration, run terraform init, run terraform plan to view planned

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

#Terraform workflow#terraform init#terraform plan#terraform apply#CLI commands

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice