ExamGecko
Question list
Search
Search

Question 87 - Terraform Associate 003 discussion

Report
Export

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 correct answers.

A.
Run the terraform Import-gcp command
Answers
A.
Run the terraform Import-gcp command
B.
Write Terraform configuration for the existing VMs
Answers
B.
Write Terraform configuration for the existing VMs
C.
Use the terraform import command for the existing VMs
Answers
C.
Use the terraform import command for the existing VMs
D.
Provision new VMs using Terraform with the same VM names
Answers
D.
Provision new VMs using Terraform with the same VM names
Suggested answer: B, C

Explanation:

To import existing resources into Terraform, you need to do two things1:

Write a resource configuration block for each resource, matching the type and name used in your state file.

Run terraform import for each resource, specifying its address and ID. There is no such command as terraform Import-gcp, and provisioning new VMs with the same names will not import them into Terraform.

asked 18/09/2024
Marcin Piotrowski
40 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first