nerdexam
HashiCorp

TERRAFORM-ASSOCIATE-004 · Question #247

A developer launched a VM outside of the Terraform workflow and ended up with two servers with the same name. They are unsure which VM is managed with Terraform, but they do have a list of all active

The correct answer is D. Run terraform state list to find the names of all VMs, then run terraform state show for each of. terraform state list shows all resources currently managed by Terraform. terraform state show <resource> provides detailed attributes, including the VM ID. This lets you match the Terraform- managed instance with the actual infrastructure.

Submitted by akirajp· Apr 18, 2026Manage Terraform State

Question

A developer launched a VM outside of the Terraform workflow and ended up with two servers with the same name. They are unsure which VM is managed with Terraform, but they do have a list of all active VM IDs. Which method could you use to determine which instance Terraform manages?

Options

  • AModify the Terraform configuration to add an import block for both of the virtual machines.
  • BRun a terraform apply -refresh to identify the virtual machine IDs that are already managed by
  • CRun terraform state rm on both VMs, then terraform apply to recreate the correct one.
  • DRun terraform state list to find the names of all VMs, then run terraform state show for each of

How the community answered

(31 responses)
  • A
    3% (1)
  • B
    3% (1)
  • C
    10% (3)
  • D
    84% (26)

Explanation

terraform state list shows all resources currently managed by Terraform. terraform state show <resource> provides detailed attributes, including the VM ID. This lets you match the Terraform- managed instance with the actual infrastructure.

Topics

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

Community Discussion

No community discussion yet for this question.

Full TERRAFORM-ASSOCIATE-004 Practice