Terraform Associate Practice Exam 2025 – The Comprehensive All-in-One Guide to Exam Success!

Question: 1 / 400

What occurs if a VM created by Terraform is deleted via the cloud provider console and terraform apply is executed again?

It will not affect the existing Terraform state

Terraform will recreate the VM

When a VM created by Terraform is deleted directly through the cloud provider's console and then a `terraform apply` command is executed again, Terraform will indeed recreate the VM. This occurs because Terraform maintains a state file that keeps track of all the resources it manages. When the VM is deleted outside of Terraform, the state file no longer reflects the actual state of the infrastructure.

During the next execution of `terraform apply`, Terraform compares the current state (as noted in the state file) with the desired configuration defined in the Terraform code. Since the VM no longer exists in the actual environment but is still present in the state file, Terraform recognizes that there is a discrepancy. To reconcile this difference and ensure that the infrastructure matches the defined configuration, Terraform will proceed to recreate the VM as specified in the configuration files.

This automatic reconciliation process is one of the core functionalities of Terraform and underscores its purpose of managing infrastructure lifecycle efficiently.

Get further explanation with Examzify DeepDiveBeta

The command will fail due to resource mismatch

Terraform will create an error log

Next Question

Report this question

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy