Plans Introduction
In this lesson, we will learn what Terraform plans are, how they work, and how you can use them in your Terraform project.
We'll cover the following...
Terraform plans
A plan is essentially Terraform showing you how it plans to change the world to fit the desired state specified in your code. Terraform plans provide you with the following details:
- What Terraform will create,
- What Terraform will destroy, and
- What Terraform will update.
This gives you an idea of what Terraform will do before you ask Terraform to do it. Terraform summarises how many creates, updates, and destroys it will do at the bottom of the plan.
In this lesson
So far in this course, we have been running terraform apply
, which will automatically do a plan first and then wait for you to confirm. When Terraform pauses, it gives you time to review the plan to make sure it is correct before executing it. In this lesson, we will learn how to read plans and go over some key things to look out for.
Project example
Let’s create a small project so we can explore how plans work:
provider "aws" { region = "us-east-2" } resource "aws_sqs_queue" "test_queue" { name = "test_queue" }
By now, you should be able to understand what the HCL above is going to do. Namely, it is going to set up the AWS provider and create a queue with the name test_queue
.
📝Note: Clicking the run button will run
terraform init
and thenterraform apply
. When prompted, do not typeyes
just yet.
First plan
You ...