Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
HashiCorp Certified: Terraform Associate (003) · HashiCorp
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
The correct answer is **D. Terraform will recreate the VM**. When you delete the VM manually via the cloud provider's console, the actual infrastructure no longer exists, but Terraform's state file still has a record of the VM. When you run `terraform apply` again, Terraform detects that the VM is missing from the actual infrastructure and will attempt to recreate it to match the configuration defined in the Terraform code.
The people who answered C are just doomed to fail this exam. This is such a basic foundational knowledge and it's the very core of Terraform and you can't even get this simple one right? This is such a freebie question.
D. Terraform will recreate the VM When you delete a resource like a VM directly through the cloud provider's console (outside of Terraform), the Terraform state file still believes the resource exists, as it's unaware of any changes made outside its management. The next time you run terraform apply, Terraform compares the desired state (defined in your Terraform configuration) with the actual state (as recorded in the state file and observed in the cloud environment). Since the actual VM no longer exists but your Terraform configuration still defines it, Terraform detects this discrepancy and takes action to reconcile the difference by creating a new VM to match the desired state defined in your Terraform configuration. Terraform's goal is always to make the real-world infrastructure match the configuration.