nerdexam
HashiCorp

TA-002-P · Question #338

Which parameters does terraform import require? Choose two correct answers.

The correct answer is C. Resource address D. Resource ID. The terraform import command is used to bring existing infrastructure under Terraform management, requiring both the Terraform resource address to map it to and the cloud provider's ID of the actual resource. These two parameters tell Terraform which existing resource to import…

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

Question

Which parameters does terraform import require? Choose two correct answers.

Options

  • AProvider
  • BPath
  • CResource address
  • DResource ID

How the community answered

(24 responses)
  • A
    4% (1)
  • B
    4% (1)
  • C
    92% (22)

Why each option

The `terraform import` command is used to bring existing infrastructure under Terraform management, requiring both the Terraform resource address to map it to and the cloud provider's ID of the actual resource. These two parameters tell Terraform which existing resource to import and where to place it within the state.

AProvider

The `provider` is implicitly determined by the resource address being imported (e.g., `aws_instance` implies the AWS provider) and is not a direct parameter to the `import` command itself.

BPath

`Path` is not a direct parameter for `terraform import`; instead, `resource address` refers to the logical path within the Terraform configuration.

CResource addressCorrect

The `terraform import` command requires two main arguments: the `resource address` (e.g., `aws_instance.webserver`) which specifies where the resource should be mapped in the Terraform state, and the `resource ID` (e.g., `i-0123456789abcdef0`) which is the unique identifier of the existing resource in the cloud provider. Together, these allow Terraform to accurately add the existing resource to its state file.

DResource IDCorrect

The `terraform import` command requires two main arguments: the `resource address` (e.g., `aws_instance.webserver`) which specifies where the resource should be mapped in the Terraform state, and the `resource ID` (e.g., `i-0123456789abcdef0`) which is the unique identifier of the existing resource in the cloud provider. Together, these allow Terraform to accurately add the existing resource to its state file.

Concept tested: Terraform import command syntax

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

Topics

#terraform import#CLI parameters#resource address#resource ID

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice