HashiCorp Certified: Terraform Associate (003) — Question 19
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.)
Answer options
- A. Provision new VMs using Terraform with the same VM names.
- B. Use the terraform import command for the existing VMs.
- C. Write Terraform configuration for the existing VMs.
- D. Run the terraform import-gcp command.
Correct answer: C
Explanation
To manage existing VMs with Terraform, you need to write Terraform configuration that defines these VMs (option C). Additionally, you must use the terraform import command to bring the existing resources under Terraform management, which is not explicitly mentioned as an option here but is implied by the need to import them. Options A and D are incorrect because creating new VMs would not help in managing existing ones, and terraform import-gcp is not a valid command.