HashiCorp
TERRAFORM-ASSOCIATE-004 · Question #41
You have a Terraform configuration that defines a single virtual machine with no references to it, You have run terraform apply to create the resource, and then removed the resource definition from yo
The correct answer is D. Terraform will destroy the virtual machine. This is what will happen if you run terraform apply in the working directory again, after removing the resource definition from your Terraform configuration file. Terraform will detect that there is a resource in the state file that is not present in the configuration file, and w
Submitted by rohit_dlh· Apr 18, 2026Manage Terraform State
Question
You have a Terraform configuration that defines a single virtual machine with no references to it, You have run terraform apply to create the resource, and then removed the resource definition from your Terraform configuration file. What will happen you run terraform apply in the working directory again?
Options
- ATerraform will remove the virtual machine from the state file, but the resource will still exist
- BNothing
- CTerraform will error
- DTerraform will destroy the virtual machine
How the community answered
(36 responses)- B3% (1)
- C3% (1)
- D94% (34)
Explanation
This is what will happen if you run terraform apply in the working directory again, after removing the resource definition from your Terraform configuration file. Terraform will detect that there is a resource in the state file that is not present in the configuration file, and will assume that you want
Topics
#Terraform State Management#Resource Destruction#Terraform Apply Command#Configuration Reconciliation
Community Discussion
No community discussion yet for this question.