nerdexam
HashiCorp

TA-002-P · Question #23

Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.)

The correct answer is B. Apply D. Init. To provision new infrastructure with Terraform, you must first initialize the working directory and then apply the planned changes.

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

Question

Which two steps are required to provision new infrastructure in the Terraform workflow? (Choose two.)

Options

  • ADestroy
  • BApply
  • CImport
  • DInit
  • EValidate

How the community answered

(35 responses)
  • B
    91% (32)
  • C
    3% (1)
  • E
    6% (2)

Why each option

To provision new infrastructure with Terraform, you must first initialize the working directory and then apply the planned changes.

ADestroy

`terraform destroy` removes all the infrastructure managed by a given Terraform configuration, which is the opposite of provisioning new infrastructure.

BApplyCorrect

The `terraform apply` command executes the actions proposed in a Terraform plan, provisioning or updating infrastructure resources as defined in the configuration. It is a mandatory step to create or modify infrastructure.

CImport

`terraform import` is used to bring existing infrastructure under Terraform management, not to provision new infrastructure from scratch.

DInitCorrect

The `terraform init` command initializes a Terraform working directory, downloading necessary provider plugins and modules, and setting up the backend, which is essential before any other commands like `plan` or `apply` can be run.

EValidate

`terraform validate` checks the syntax and configuration logic of Terraform files but does not provision any infrastructure itself.

Concept tested: Terraform core workflow commands

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

Topics

#Terraform workflow#Provisioning infrastructure#terraform init#terraform apply

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice