October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsPC HealthRecommendedCrashes, freezes, slowdowns? Check your PC nowSpot repairable issues before they interrupt work.Check PCOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk4 min

How to Read and Troubleshoot OpenTofu Plan Output

A practical guide to reading OpenTofu plan summaries, handling detailed exit codes, inspecting saved plans, and diagnosing CLI and JSON mismatches.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

A tofu plan shows proposed infrastructure actions; it does not apply them. Read the plan summary and each resource action to check whether the proposal matches your intent. For automation, use -detailed-exitcode carefully: exit code 2 means a successful plan found changes, not that the command failed.

What a tofu plan tells you

OpenTofu reads existing remote objects, compares them with your configuration and prior state, then produces a proposed set of actions. The plan is a preview, not evidence that anything has changed in the target system. A plan run without -out is speculative; because the target may change after planning, generate and review a fresh final plan before applying it. See the OpenTofu plan command documentation.

As an Amazon Associate I earn from qualifying purchases.

Start with the summary at the end of the output, then inspect the individual resources and their proposed actions. For example, Plan: 1 to add, 0 to change, 0 to destroy means OpenTofu proposes creating one resource, changing none, and destroying none. The counts describe the proposal, not completed operations. If the summary or a resource-level action is unexpected, stop and investigate before applying.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

How to interpret detailed exit codes

The three-value convention applies when you run tofu plan -detailed-exitcode. The codes distinguish a clean plan, a plan with changes, and an error:

Exit code Meaning with -detailed-exitcode How automation should treat it
0 Command succeeded with an empty diff: no changes. Continue along the no-change path.
1 An error occurred. Handle as a failed plan and inspect the error output.
2 Command succeeded with a non-empty diff: changes are present. Handle as a successful plan that needs the changes path, not as an ordinary command failure.

A shell or CI system may regard any nonzero status as failure by default. If your script uses this option, explicitly branch on all three values rather than treating 2 like 1. These meanings are documented in the plan command reference.

Choose the right way to inspect a plan

Use the human-readable command for interactive review and JSON when a program needs structured data. Use -out when you need to save the plan for later inspection or application.

Need Command What to expect
Review a saved plan in a terminal tofu show PLANFILE Human-readable plan output.
Parse a saved plan in a script or other consumer tofu show -json PLANFILE Structured JSON containing more than the terminal summary, including plan, configuration, values or prior-state, resource-change, and check data.
Save a plan for later review or application tofu plan -out=FILE A saved plan artifact that can be inspected with tofu show.

The commands and output behavior are described in the show command reference, plan command reference, and JSON Output Format documentation.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Protect saved plans and JSON output

Saved plan files and their derived output can contain sensitive information. A saved plan may retain configuration, variable values, and sensitive values even when the terminal masks them. JSON output can expose sensitive state values in plain text. Treat both the plan file and JSON as confidential: restrict access, avoid attaching them casually to tickets, and prevent CI logs from publishing them. OpenTofu documents these risks in its plan and show command references.

Why tofu show may not display a plan cleanly

Interpreting provider-specific details depends on provider schema information. If the provider versions installed now differ from those used to create the artifact, schema upgrades may be needed. Check which providers were used to create the plan and which are installed before concluding that its contents are corrupt. OpenTofu also documents constraints on viewing plans created with refresh disabled. The show command reference explains these requirements; the init command reference covers provider initialization.

Why JSON can show resource changes when the plan says “No changes”

Do not assume every entry in JSON resource_changes proves that OpenTofu considers the overall plan non-empty. OpenTofu documents an ephemeral-resource edge case: an open action can appear in resource_changes, while OpenTofu’s emptiness test ignores that action. The CLI can therefore say “No changes” and return detailed exit code 0 even though a JSON consumer sees an entry. A consumer that treats any resource-change entry as a change can misclassify this plan. See the provider documentation.

JSON is a versioned format, not an unchanging schema. The documented compatibility policy says consumers should tolerate compatible minor additions by ignoring unknown properties, and reject an unsupported major format version. Check format_version and write parsers to handle the documented compatibility rules rather than assuming every field set is fixed. See OpenTofu’s JSON format documentation.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Diagnose a mismatch between the CLI and a script

When the typed command, terminal output, exit status, and a downstream parser disagree, verify the effective command before changing the parser or plan. The installed OpenTofu version matters: documentation examples may differ from the behavior of another version. Also check whether environment variables added arguments behind the scenes.

  • TF_CLI_ARGS can add arguments to every CLI command.
  • TF_CLI_ARGS_plan can add arguments specifically to tofu plan.

Inspect these variables alongside the command shown in the script or CI configuration, then compare the CLI’s empty-plan result with the JSON consumer’s logic—especially if ephemeral resources are involved. OpenTofu documents command-wide and command-specific argument injection in its environment variables reference; version-related CLI behavior is covered in Basic CLI Features.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. World desk4 min
    How to Spot an AI Voice Scam Before Sending MoneyDon’t rely on how a caller sounds. Pause, call back through a known number, and verify the emergency with another trusted person before sending money.
  2. Mountain View desk4 min
    Google’s SynthID Detector: How to Check AI-Generated Images, Video and AudioGoogle’s SynthID Detector looks for an embedded watermark in supported images, video and audio. Here is what its results do—and do not—show.
  3. Redmond desk20 min
    How to create a link to File or Folder in Windows 11Windows 11 gives you several ways to point to a file or folder without moving or duplicating it. You can create a desktop shortcut,…
Recommended PC Tool
Recommended PC Tool
Windows Errors? Fix Them Before They SpreadFree repair scan
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.