Exam4Training

What will happen you run terraform apply in the working directory again?

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?
A . Terraform will remove the virtual machine from the state file, but the resource will still exist
B . Nothing
C . Terraform will error
D . Terraform will destroy the virtual machine

Answer: D

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 to delete it.

Exit mobile version