How to Review a Terraform Plan JSON Before You Apply It
Learn how terraform show -json works and how to review plans and state visually: change counts, attribute diffs, known-after-apply values and dependencies.

How to Review a Terraform Plan JSON Before You Apply It
Running terraform apply on a plan you did not read carefully is one of the classic ways to lose a database. The terminal output of a large plan can be hundreds of lines long, and the one line that says a resource must be replaced can scroll by unnoticed. Terraform can also describe the same plan as structured JSON, and once it is structured it can be summarised, filtered and drawn. This guide explains what is inside that JSON and how to review it visually.
Plan, state and the JSON format
Terraform compares three things: your configuration, the recorded state of what it manages, and the real infrastructure reported by providers. The plan is the list of actions needed to make reality match the configuration.
You can export a saved plan as JSON in two steps: create the plan with terraform plan -out=plan.out, then convert it with terraform show -json plan.out > plan.json. The structure is documented in HashiCorp's JSON output format reference. The important parts for review are:
- resource_changes: one entry per resource, each with a list of actions such as create, update, delete, read or a delete-and-create pair;
- change.before and change.after: the attribute values on both sides;
- after_unknown: attributes whose values only exist once the provider creates or updates the resource, such as new IDs;
- before_sensitive and after_sensitive: which attributes are marked sensitive;
- replace_paths and action_reason: why a replacement is required;
- configuration: the references between resources, which reveal dependencies.
State files use their own JSON format (version 4 in current Terraform), with each resource instance's attributes and its recorded dependencies.
Why a visual review helps
A replacement is the change that most often causes outages, because the old object is destroyed and a new one created. Terraform's summary line counts a replacement as one addition and one destruction, so "2 to destroy" might mean one deletion and one replacement. Seeing each resource with its action, the attributes that force replacement, and what depends on it makes this obvious.
Reviewing a plan with the viewer
Open the Terraform Plan and State Viewer and press Open plan or state JSON, or paste the JSON into the JSON tab.
- Read the summary. Counts for create, update, replace, delete and read appear with the familiar
+,~,-/+and-symbols and colours, plus the same Plan line Terraform prints. Look at destroy and replace first. - Filter. Hide actions you are not interested in, or type part of an address to find a resource.
- Inspect a resource. Selecting one shows its changed attributes with before and after values. Nested values are flattened into paths like
tags.Nameoringress[0].from_port. Values marked(known after apply)are computed later by the provider; values marked(sensitive)are hidden the same way the CLI hides them. Tick show unchanged attributes to see everything. For replacements, the attributes that force a new resource and Terraform's reason are listed. - Explore structure. By module groups resources by module and type. Dependency graph places resources with no dependencies on the left and those that rely on them further right, coloured by planned action.
- Share. Download the changes as CSV to attach to a ticket or pull request.
A worked example
The built-in sample plan contains a new subnet, an RDS database whose allocated storage grows from 20 to 50 GB together with a sensitive password change, a web server that must be replaced because its AMI changed, a CloudFront distribution in module.cdn that will be destroyed, and an unchanged VPC.
The summary reads Plan: 2 to add, 1 to change, 2 to destroy. At first glance that sounds like two deletions, but the resource list shows that one of them is the web server replacement. Selecting the web server reveals that the AMI attribute forces the new resource. Selecting the database shows the storage change in clear text and the password as (sensitive). The graph shows the chain from VPC to subnet to the web server and database, so you can see which resources sit downstream of the change.
Review tips
- Treat every replace as a delete. Ask whether data, IP addresses or DNS records will survive.
- Check known-after-apply values on resources others depend on. A new ID can ripple into updates elsewhere on the next run.
- Look for surprises in modules. A version bump of a module can change resources you never touched.
- Handle state carefully. Sensitive markers hide values in the view, but a state file itself may contain secrets in plain text. Keep it out of chat messages and public repositories, even though the viewer parses it locally in your browser.
- For remote state, run
terraform state pull > state.jsonand open the downloaded file.
Limits
The viewer reads JSON only; it cannot open binary plan files or HCL source code, and it does not run Terraform or contact your cloud provider. Drift details, moved blocks and provider schemas are not interpreted. The dependency graph is built from configuration references or recorded state dependencies, not from Terraform's full internal graph, so implicit ordering created by providers may be missing. It helps you read a plan; the decision to apply remains yours, together with your team's review process.



