terraform plan
The command that compares configuration, state and reality and prints the actions needed to make them match, without changing anything.
In more detail
It first refreshes, asking providers what really exists, then lists each resource to create, update, replace or destroy, with a summary count at the bottom. Read the summary first, then look closely at every replacement and destroy. A plan is a prediction made at one moment: someone else can change things before you apply.
Example
Plan: 1 to add, 0 to change, 0 to destroy.Related terms
- Terraform — An infrastructure-as-code tool from HashiCorp that creates and changes cloud resources such as servers, networks and databases from configuration files.
- pull request — A request on a hosting service such as GitHub to merge one branch into another, with a page for review, discussion and automated checks.
- Terraform state — Terraform's record, usually a JSON file called terraform.tfstate, mapping each resource in the configuration to the real object it created.
- resource replacement — When Terraform must destroy a resource and create a new one because a changed setting cannot be updated in place.
- Conftest — A command-line tool that runs Rego policies against configuration files such as Terraform plan JSON, YAML and Dockerfiles.
- -detailed-exitcode — A terraform plan option that exits 0 when there are no changes, 1 on error and 2 when changes are present.
- plan symbols — The marks at the start of each plan line that say what will happen: + create, - destroy, ~ update in place, -/+ or +/- replace, <= read.
- saved plan — A plan written to a file with -out, which terraform apply can later carry out exactly as reviewed.
- refresh — Terraform asking each provider what the resources recorded in state really look like now, before it plans.
- terraform apply — The command that carries out a plan, creating, changing and deleting real infrastructure, then records the result in state.
- known after apply — What a plan shows for a value that cannot exist until apply, such as an identifier or checksum the provider will generate.
Taught in
- Infrastructure as Code (Handover to Terraform) — Cloud Infrastructure & Hyperscaler Architecture
- Static IaC Scanning: Linting Terraform with Checkov — Cloud Security & DevSecOps Engineering
- Enforcing OPA Guardrails on Terraform Plan Payloads — Cloud Security & DevSecOps Engineering
- Continuous IaC Drift Detection & State Protection — Cloud Security & DevSecOps Engineering
- What Is Infrastructure As Code? — Infrastructure as Code with Terraform
- Installing Terraform And Meeting The CLI — Infrastructure as Code with Terraform
- Predicting Changes, Then Applying Them — Infrastructure as Code with Terraform
- Tearing It Down With Destroy — Infrastructure as Code with Terraform
- Scaling Resources With Count — Infrastructure as Code with Terraform
- What State Really Is And Why It Is Needed — Infrastructure as Code with Terraform
- Running Terraform In CI — Infrastructure as Code with Terraform
- Native Testing With Tftest Files — Infrastructure as Code with Terraform
- Provider Mocking For Tests — Infrastructure as Code with Terraform
- Policy As Code With OPA — Infrastructure as Code with Terraform
- Releasing The Real Cloud Artifact — Infrastructure as Code with Terraform
- The Plan That Wanted To Destroy Production — HashiCorp Terraform Associate (004) Exam Prep
- One Hour, No Weights Published — HashiCorp Terraform Associate (004) Exam Prep
- Infrastructure As Code, And One Workflow For Every Platform — HashiCorp Terraform Associate (004) Exam Prep
- Providers: How Terraform Reaches Every API — HashiCorp Terraform Associate (004) Exam Prep
- Versions, The Lock File And Provider Aliases — HashiCorp Terraform Associate (004) Exam Prep
- State: Terraform's Memory Of What It Built — HashiCorp Terraform Associate (004) Exam Prep
- Write, Plan, Apply, And What Init Prepares — HashiCorp Terraform Associate (004) Exam Prep
- Reading A Plan, Saving It, Applying It — HashiCorp Terraform Associate (004) Exam Prep