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.
Quick start
Section titled “Quick start”From an initialized Terraform directory:
tiv plantiv 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.
Reading the report
Section titled “Reading the report”- A notice leads the page when the plan is not the whole story: planning stopped on an error, or the plan was made with
-targetor-excludeand 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 planprints 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.
Console mode
Section titled “Console mode”Pass --console to review the same plan without leaving the terminal:
tiv plan --console
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 selectionspaceexpands 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 listedureveals the unchanged resources, with their current values; press it again to hide themtcycles 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 andEnterjumps to the first match, thennandNwalk forward and back through the restmcycles all → each action present;pcycles providers; the two filters combine?shows the full key reference;qquits
--console and --browser are mutually exclusive. The browser remains the default for now.
Supplying a plan yourself
Section titled “Supplying a plan yourself”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:
terraform plan -out=tf.planterraform show -json tf.plan > plan.jsonThen any of these work:
tiv plan --plan plan.json # explicit pathtiv plan < plan.json # redirectedterraform show -json tf.plan | tiv plan # piped, skipping the .json filetiv plan # picks up plan.json from the current directoryWhat is not accepted
Section titled “What is not accepted”- The binary plan file itself (
tf.plan) - Human-readable
terraform planoutput, with or without-no-color - The
terraform plan -jsonlog stream, which carries no before/after values
If you pass one of these, tiv tells you the exact commands to produce the right format.
Passing options to terraform
Section titled “Passing options to terraform”These apply when tiv runs terraform for you, and are omitted otherwise:
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 |