Jump into concepts and practice - no test required
or
Recommended
Test this pattern10 questions across easy, medium, and hard to know if this pattern is strong
Plan output reading
📖 Scenario: You are managing cloud infrastructure using Terraform. You want to see what changes Terraform will make before applying them. This helps you avoid surprises and understand the planned updates.
🎯 Goal: Build a Terraform configuration that defines a simple resource, run terraform plan to generate a plan output, and then read the plan output using Terraform commands.
📋 What You'll Learn
Create a Terraform configuration file with a resource
Initialize Terraform in the directory
Run terraform plan and save the output to a file
Use Terraform commands to read and show the plan output
💡 Why This Matters
🌍 Real World
Reading Terraform plan outputs helps cloud engineers review infrastructure changes before applying them, preventing mistakes and downtime.
💼 Career
Understanding Terraform plan output reading is essential for roles like Cloud Engineer, DevOps Engineer, and Infrastructure Developer.
Progress0 / 4 steps
1
Create Terraform configuration file
Create a file named main.tf with a resource block for an AWS S3 bucket named example_bucket with bucket name my-example-bucket-12345.
Terraform
Hint
Use the resource keyword, specify aws_s3_bucket as the resource type, and name it example_bucket. Set the bucket attribute to "my-example-bucket-12345".
2
Initialize Terraform
Run terraform init in the directory to initialize Terraform and download the AWS provider plugin.
Terraform
Hint
Open your terminal and type terraform init to prepare Terraform for this configuration.
3
Run terraform plan and save output
Run terraform plan -out=plan.out to create a plan and save it to a file named plan.out.
Terraform
Hint
Use the -out flag with terraform plan to save the plan to a file.
4
Show the saved plan output
Run terraform show plan.out to read and display the saved plan output file.
Terraform
Hint
Use terraform show with the plan file name to see the planned changes.
Practice
(1/5)
1. What does the terraform plan command primarily show before applying changes?
easy
A. The current cost of your cloud resources
B. The changes Terraform will make to your infrastructure
C. The list of all Terraform providers installed
D. The history of previous Terraform apply commands
Solution
Step 1: Understand the purpose of terraform plan
This command previews the changes Terraform will perform on your infrastructure without applying them.
Step 2: Compare options with command purpose
Only The changes Terraform will make to your infrastructure correctly describes this preview of changes. Other options describe unrelated information.
Final Answer:
The changes Terraform will make to your infrastructure -> Option B
Quick Check:
Plan shows changes = B [OK]
Hint: Plan shows what changes will happen before apply [OK]
Common Mistakes:
Confusing plan with apply
Thinking plan shows costs
Assuming plan shows provider list
2. In Terraform plan output, what does the symbol ~ indicate?
easy
A. Resource will be updated
B. Resource will be created
C. Resource will be deleted
D. Resource will be ignored
Solution
Step 1: Recall Terraform plan symbols
The symbol ~ means a resource will be updated (changed in place).
Step 2: Match symbol to meaning
+ means create, - means delete, so ~ must mean update.