nerdexam
HashiCorp

TA-002-P · Question #20

You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using…

The correct answer is B. Use the terraform import command for the existing VMs D. Run the terraform import-gcp command. To bring existing infrastructure under Terraform management, two steps are required: (B) run 'terraform import' to map each real-world resource into the Terraform state file, and (C) write Terraform configuration blocks that describe those existing resources - Terraform…

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

Question

You have provisioned some virtual machines (VMs) on Google Cloud Platform (GCP) using the gcloud command line tool. However, you are standardizing with Terraform and want to manage these VMs using Terraform instead. What are the two things you must do to achieve this? (Choose two.)

Options

  • AProvision new VMs using Terraform with the same VM names
  • BUse the terraform import command for the existing VMs
  • CWrite Terraform configuration for the existing VMs
  • DRun the terraform import-gcp command

How the community answered

(49 responses)
  • A
    14% (7)
  • B
    78% (38)
  • C
    8% (4)

Explanation

To bring existing infrastructure under Terraform management, two steps are required: (B) run 'terraform import' to map each real-world resource into the Terraform state file, and (C) write Terraform configuration blocks that describe those existing resources - Terraform requires matching config to reconcile state against. Option D ('terraform import-gcp') is not a real Terraform command and does not exist. The provided answer key listing D is incorrect; the correct pair is B and C.

Topics

#Terraform Import#GCP#Existing Resources#CLI

Community Discussion

No community discussion yet for this question.

Full TA-002-P Practice