Courseiva

TF-004 Use the core Terraform workflow Practice Question

Exhibit

Refer to the exhibit.

```
$ terraform plan -out=tfplan
$ terraform apply "tfplan"
```
The developer runs the commands above. During the apply, the network connection is lost and the command fails halfway through. The developer re-establishes connectivity and runs `terraform apply` again without specifying a plan file. What will happen?

Refer to the exhibit. A developer runs `terraform plan -out=tfplan` and then `terraform apply "tfplan"`. During apply, network fails and apply is interrupted. The developer then runs `terraform apply` again (without a plan file). What will happen?

⚠ Common exam trap

HashiCorp often tests the misconception that Terraform can resume or automatically reuse a plan file after an interruption, when in fact it always re-plans from the current state to ensure consistency.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

It will create a new plan and apply only the changes that are still needed

When `terraform apply` is run without a plan file, Terraform automatically creates a new plan based on the current state and configuration, then applies only the changes that are still needed. Since the previous apply was interrupted, the state file reflects the partial progress, and the new plan will detect any remaining resources that still need to be created, updated, or destroyed, ensuring idempotent behavior.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    It will automatically use the previously saved plan file `tfplan`

    Why it's wrong here

    The `terraform plan` command, when run without any arguments, always generates a *new* execution plan by comparing the current configuration with the remote infrastructure and the existing state file. To utilize a previously saved plan file (e.g., one created with `terraform plan -out=tfplan`), you must explicitly specify it using `terraform apply tfplan`. Running `terraform plan` alone will not automatically detect or reuse any existing plan files.

  • ✗

    It will fail because the state is locked from the previous apply

    Why it's wrong here

    Terraform's state locking mechanism is primarily designed to prevent concurrent write operations from corrupting the state. While a lock is acquired during an `apply` operation, it is typically released upon completion, even if the apply was incomplete or failed. If a lock were to persist due to an abnormal termination (a "stale lock"), `terraform plan` would usually attempt to acquire its own lock or report the existing lock, but it wouldn't inherently "fail" due to a previous apply's lock unless it was truly stuck. More commonly, the lock would have been released.

  • ✓

    It will create a new plan and apply only the changes that are still needed

    Why this is correct

    When `terraform plan` is executed, it first performs a state refresh, comparing the current configuration against the actual state of resources in the cloud and the Terraform state file. If a previous `apply` was incomplete, this refresh will accurately identify which resources were successfully created or modified. Consequently, the new plan will only propose actions for the remaining resources that are either missing, require further modification, or need to be destroyed according to the desired state defined in the configuration.

  • ✗

    It will resume the previous apply from where it left off

    Why it's wrong here

    Terraform operations are inherently idempotent and do not feature an automatic "resume" capability for interrupted `apply` commands. Each `terraform plan` or `terraform apply` command initiates a fresh evaluation cycle. It will re-read the configuration, refresh the state against the remote infrastructure, and then compute a new set of actions required to reach the desired state, rather than attempting to pick up a partially completed operation from its last known point of interruption.

About these practice questions

Courseiva writes every TF-004 question from scratch — 434 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This TF-004 practice question is part of Courseiva's free HashiCorp certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the TF-004 exam.