Exam Terraform Associate All QuestionsBrowse all questions from this exam
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 Terraform instead.

What are the two things you must do to achieve this? (Choose two.)

    Correct Answer: B, C

    To manage existing VMs on Google Cloud Platform using Terraform, you need to follow two crucial steps. First, you should use the 'terraform import' command to import the existing VMs into Terraform's state file. This step allows Terraform to recognize and manage those resources. Second, you must write Terraform configuration that describes the current state of these VMs. This configuration allows Terraform to maintain and update the VMs as needed in the future. Provisioning new VMs with the same names would create duplicates and potential conflicts, and there is no 'terraform import-gcp' command in Terraform.

Discussion
tipzzzOptions: BC

BC for sure

fabiomlopOptions: BC

You should create the equivalent configuration first, and then run import to load it on the state file.

AzRNoobOptions: BC

BC are the correct options: B. Use the terraform import command for the existing VMs. This command allows you to import existing infrastructure into your Terraform state file so that Terraform can manage it. You will need to provide the resource type and name, along with any required attributes, for each VM you want to import. C. Write Terraform configuration for the existing VMs. Once the VMs have been imported into the Terraform state file, you will need to write configuration code that describes the desired state of the VMs. This will typically involve creating a new Terraform module or modifying an existing one to include the imported resources. Option A is incorrect because provisioning new VMs with the same names would create duplicate resources and could cause conflicts with the existing VMs. Option D is also incorrect because there is no terraform import-gcp command in Terraform. The correct command for importing GCP resources is simply terraform import.

Tyler2023Options: BC

There are two ways to manage existing resource using Terraform You can use 'terraform import' or you can use the import block So answers are: B. Use the terraform import command for the existing VMs Most Voted C. Write Terraform configuration for the existing VMs https://developer.hashicorp.com/terraform/cli/import/usage https://developer.hashicorp.com/terraform/language/import

kingfighers

there is no 'import-gcp' in terraform official doc

enookOptions: BC

BCBCBCBCBCBC

JayanthOptions: BC

B. Use the terraform import command for the existing VMs C. Write Terraform configuration for the existing VMs

Busi57Options: BC

i choose BC

Ni33Options: BC

B&C are correct

doodlearmyOptions: BC

there is no 'import-gcp' in terraform official doc

Busi57Options: BC

i choose BC

Shane_COptions: BC

BC are the correct answers here

milan92stankovicOptions: BC

Write configuration and import.

karendavtyanOptions: BC

B.True C. True

connecttozeeOptions: BC

BC is correct https://developer.hashicorp.com/terraform/tutorials/state/state-import

Power123Options: BC

B,C - first write the configuration and then import

acheironOptions: BC

Write configuration then import the existing infrastructure.