Terraform Plan vs Apply: A Beginner’s Guide to Understanding the Difference

Learn the difference between terraform plan and terraform apply, how they work together, and why using both helps beginners deploy safely.

Terraform Plan vs Apply: A Beginner’s Guide to Understanding the Difference
Terraform Plan vs Apply: A Beginner’s Guide to Understanding the Difference

If you’re new to Terraform you’ll quickly come across these two commands:

  • terraform plan
  • terraform apply

At first glance, they can feel confusing. Why do you need both? Why not just apply and get on with it?

Understanding the difference between plan and apply is one of the most important concepts in Terraform. It’s also one of the things that helps prevent broken deployments, unexpected costs, and accidental deletions.

In this post, we’ll break down what each command does, how they work together, and the best practices for using them safely.

What is Terraform plan?

Terraform plan allows you to preview what Terraform is about to do. When you run terraform plan, it does the following:

  • Reads your Terraform configuration files
  • Compares them with the current state file
  • Shows you exactly what changes it plans to make

But crucially, it makes no changes to your environment.

Running the plan command will produce output that tells you whether your code will create new resources, update existing resources, or destroy resources that are no longer needed. 

Terraform plan allows you to check what would happen if you deployed the code, without actually deploying it. This ultimately gives you the chance to spot problems before anything happens.

What is Terraform apply?

Terraform apply is the command that actually makes changes. When you run terraform apply, Terraform does the following:

  • Takes the planned changes
  • Calls the cloud provider APIs
  • Creates, updates, or deletes resources
  • Updates the Terraform state file to reflect reality

When running the terraform apply command, this is where things become real. Once apply runs, your infrastructure is changed.

By default, with Terraform apply you do get a safety check. You are asked if you want to carry out the actions, so there is a pause for you to double-check before you commit anything.

How Terraform plan and Terraform apply work together

The normal Terraform workflow looks like this: 

  1. Write or update Terraform code
  2. Run terraform init to prepare the working directory for use with Terraform. 
  3. Run terraform plan
  4. Review the output carefully
  5. Run terraform apply
  6. Approve the changes

Common beginner mistakes

Often, when beginners are learning Terraform, some of the mistakes they make are:

  • Skipping terraform plan. It’s very tempting to go straight to apply, especially when you are learning and just playing around with test infrastructure. However, doing this means you don’t get into the habit of using both commands, and you could cause accidental deletions or unexpected costs.
  • Not reading the plan output. Terraform will tell you exactly what it’s going to do, but only if you read it. Always take a look at it to understand what will happen when you run apply.
  • Using -auto-approve too early. There is a command, “terraform apply -auto-approve”, that skips the confirmation prompt. This can be useful in automation, but for beginners it removes an important safety net. Avoid using it while learning.

Final thoughts

If you take one thing away from this post, it should be this:

  • terraform plan helps you understand what will change.
  • terraform apply is what actually changes things.

Terraform is powerful, but with that power comes responsibility. Using plan properly is how you stay in control of your infrastructure, avoid surprises, and deploy with confidence.