If you have a simple Terraform configuration with one VM and you apply again immediately after a successful apply with no code changes, what will happen?

Prepare for the HashiCorp Terraform Associate Exam. Utilize flashcards and multiple-choice questions with detailed hints and explanations. Boost your confidence and be ready for success!

Multiple Choice

If you have a simple Terraform configuration with one VM and you apply again immediately after a successful apply with no code changes, what will happen?

Explanation:
Terraform is declarative and idempotent: it only changes things when the real infrastructure diverges from what your configuration describes. If you run apply again right after a successful apply and you haven’t changed the code, the current state already matches the desired state. Terraform will refresh to confirm the live state, then determine there are no differences, and finish without making any API calls to create, destroy, or modify resources. So nothing happens—no new VM is created, no existing VM is terminated or recreated. This is the expected behavior when there’s no drift or code changes.

Terraform is declarative and idempotent: it only changes things when the real infrastructure diverges from what your configuration describes. If you run apply again right after a successful apply and you haven’t changed the code, the current state already matches the desired state. Terraform will refresh to confirm the live state, then determine there are no differences, and finish without making any API calls to create, destroy, or modify resources. So nothing happens—no new VM is created, no existing VM is terminated or recreated. This is the expected behavior when there’s no drift or code changes.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy