nerdexam
HashiCorpHashiCorp

TA-002-P · Question #74

TA-002-P Question #74: Real Exam Question with Answer & Explanation

The correct answer is B: As a part of terraform plan. While terraform import is a standalone command, newer Terraform versions (1.5+) allow import operations to be defined in import blocks within HCL, which are then processed and previewed as part of the terraform plan lifecycle.

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

Question

How is terraform import run?

Options

  • AAs a part of terraform init
  • BAs a part of terraform plan
  • CAs a part of terraform refresh
  • DBy an explicit call
  • EAll of the above

Explanation

While terraform import is a standalone command, newer Terraform versions (1.5+) allow import operations to be defined in import blocks within HCL, which are then processed and previewed as part of the terraform plan lifecycle.

Common mistakes.

  • A. terraform init initializes the working directory, downloads providers, and sets up backends; it does not involve importing resources.
  • C. terraform refresh updates the state file to reflect the current real-world infrastructure, but it does not import new, unmanaged resources into the state.
  • D. While terraform import (the CLI command) is run by an explicit call, the question might be implicitly referring to how import operations are integrated into the overall Terraform workflow with import blocks, where plan plays a crucial role.
  • E. terraform import (the command) is not part of init, plan, or refresh commands directly, and import blocks are specifically part of the plan/apply lifecycle, not all of them.

Concept tested. Terraform import process lifecycle

Reference. https://developer.hashicorp.com/terraform/language/import

Topics

#terraform import#terraform plan#CLI workflow#State management

Community Discussion

No community discussion yet for this question.

Full TA-002-P PracticeBrowse All TA-002-P Questions