nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-004 · Question #108

A developer accidentally launched a VM (virtual machine) outside of the Terraform workflow and ended up with two servers with the same name. They don't know which VM Terraform manages but do have a li

The correct answer is A. Run terraform state list to find the names of all VMs, then run terraform state show for each of. The terraform state list command lists all resources that are managed by Terraform in the current state file. The terraform state show command shows the attributes of a single resource in the state file. By using these two commands, you can compare the VM IDs in your list with th

Submitted by stefanr· Apr 18, 2026Manage Terraform State

Question

A developer accidentally launched a VM (virtual machine) outside of the Terraform workflow and ended up with two servers with the same name. They don't know which VM Terraform manages but do have a list of all active VM IDs. Which of the following methods could you use to discover which instance Terraform manages?

Options

  • ARun terraform state list to find the names of all VMs, then run terraform state show for each of
  • BUpdate the code to include outputs for the ID of all VMs, then run terraform plan to view the
  • CRun terraform taint/code on all the VMs to recreate them
  • DUse terraform refresh/code to find out which IDs are already part of state

How the community answered

(55 responses)
  • A
    75% (41)
  • B
    4% (2)
  • C
    5% (3)
  • D
    16% (9)

Explanation

The terraform state list command lists all resources that are managed by Terraform in the current state file. The terraform state show command shows the attributes of a single resource in the state file. By using these two commands, you can compare the VM IDs in your list with the ones in the state file and identify which one is managed by Terraform.

Topics

#Terraform state#CLI commands#Resource identification#State inspection

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice