Skip to content
tiv
GitHub

tiv plan

See what a Terraform plan will do before you apply it: every change with before and after values, and a graph of how the changing resources relate.

From an initialized Terraform directory:

Terminal window
tiv plan

tiv runs terraform plan into a temporary file, converts it, and serves the report at http://127.0.0.1:4747, opening your browser. Nothing is applied, and no plan files are left behind.

  • A notice leads the page when the plan is not the whole story: planning stopped on an error, or the plan was made with -target or -exclude and covers only part of the configuration.
  • Change counts across the top: add (green), change (amber), destroy (red), replace (purple), and drifted (pink) when refreshing found resources changed outside Terraform. Each chip is a filter. Click one to hide that kind of change in both the list and the graph.
  • The graph shows changed resources inside their module containers, with arrows for dependencies between them. A module called from another module draws inside its parent’s container. Clicking a node jumps to its detail card. When filters change, the graph re-lays itself out.
  • Changed outside Terraform lists the drifted resources with the diff from what state recorded to what exists now. A drifted resource the plan also changes is tagged “drifted” on its change card, so you can tell a reaction from a planned change.
  • Change cards, grouped by module, say what will happen and, when Terraform recorded one, why: “cannot be updated in place”, “no longer in configuration”, “waiting on a pending change”. A resource an import block brings in is tagged “import”; one a moved block renamed says where it moved from. Each card expands to an attribute diff laid out the way terraform plan prints it: nested blocks, objects and lists indent their members beneath them, with list elements numbered [0], [1]. Values Terraform cannot know yet show as (known after apply). Sensitive values are masked, whole objects included. Updates show only the attributes that change, with a count of the hidden unchanged ones at every level, and the attribute that forces a replacement is tagged.
  • Dependency chips on each card (“depends on” / “used by”) jump to the related resource.
  • Moved lists every resource a moved block renamed, old address to new, including the ones the plan then leaves alone.
  • Outputs lists the root outputs the plan changes with their before and after values, masked when sensitive, and counts the ones it leaves alone.
  • Search filters cards by resource address.

Pass --console to review the same plan without leaving the terminal:

Terminal window
tiv plan --console

tiv plan –console: opening a change into its diff, searching for the replaced queue and reading why it is replaced, following an edge to a resource that uses it, then cycling the graph, list and module views

Changed resources are laid out in dependency columns, each card bordered in its action’s colour and led by its sign: + create (green), ~ update (amber), − destroy (red), ± replace (purple), ≠ drifted (pink) for a resource changed outside Terraform that the plan leaves alone. Resources the plan leaves alone otherwise stay hidden until you ask for them. The header counts drifted resources, changed outputs and moves alongside the actions, and its first line warns when the plan errored or is partial.

  • ↑↓ move within a column; ←→ follow dependency edges across columns, with connector arrows drawn beside the selection
  • space expands the selected change into a diff: - lines are values leaving, + lines are values arriving, (known after apply) marks what Terraform cannot know yet, and sensitive values stay masked. Nested blocks and objects indent their members beneath them, each noting how many unchanged members it hides, and the attribute forcing a replacement says so beside its name. The diff opens with what else there is to know: why Terraform chose the action, where a moved resource came from, the ID an import brings a resource in under, and whether the resource had also changed outside Terraform. The footer repeats the reason beside the action, and a resource an import block brings in or that also drifted is badged wherever it is listed
  • u reveals the unchanged resources, with their current values; press it again to hide them
  • t cycles three views of the plan: the dependency graph, a flat list, and the modules the changes sit in. The module view shows what each module is passed and declares
  • / searches by resource address and Enter jumps to the first match, then n and N walk forward and back through the rest
  • m cycles all → each action present; p cycles providers; the two filters combine
  • ? shows the full key reference; q quits

--console and --browser are mutually exclusive. The browser remains the default for now.

Terraform saves plans as a binary file that no tool reads directly. terraform show -json converts it, so producing plan input by hand is a two-step process:

Terminal window
terraform plan -out=tf.plan
terraform show -json tf.plan > plan.json

Then any of these work:

Terminal window
tiv plan --plan plan.json # explicit path
tiv plan < plan.json # redirected
terraform show -json tf.plan | tiv plan # piped, skipping the .json file
tiv plan # picks up plan.json from the current directory
  • The binary plan file itself (tf.plan)
  • Human-readable terraform plan output, with or without -no-color
  • The terraform plan -json log stream, which carries no before/after values

If you pass one of these, tiv tells you the exact commands to produce the right format.

These apply when tiv runs terraform for you, and are omitted otherwise:

Terminal window
tiv plan --chdir infra --var 'region=eu-west-1' --var-file prod.tfvars
Flag Default What it does
--plan none Path to a plan JSON file
--console false Render the report as an interactive terminal UI
--browser false Serve the report in the browser (the current default; excludes --console)
--port 4747 Report server port (random fallback when taken)
--open true Open the report in your browser
--chdir none Directory to run terraform in (like terraform -chdir)
--var none Terraform input variable, repeatable
--var-file none Terraform variable file, repeatable