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?
- Terraform will remove the virtual machine from the state file, but the resource will still exist
- Nothing
- Terraform will error
- Terraform will destroy the virtual machine
Answer(s): 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.
Reveal Solution Next Question