Documentation
¶
Overview ¶
Package tfplantui renders a HashiCorp Terraform plan as an interactive terminal UI: a dependency graph laid out in columns by dependency depth, with expandable, color-coded before→after attribute diffs.
It is designed to drop into any CLI. Give it a plan and it takes over the terminal until the user quits — the loading (binary plan file vs. plan JSON vs. stdin) is handled for you. The whole integration is usually one line from your own flag handler:
func runPlanFlag(path string) error { return tfplantui.Run(path) }
For a non-interactive overview (CI, quick triage) use Summary; if you already hold plan JSON in memory use RunJSON.
Index ¶
- func Run(path string, opts ...Option) error
- func RunContext(ctx context.Context, path string, opts ...Option) error
- func RunJSON(planJSON []byte, opts ...Option) error
- func RunJSONContext(ctx context.Context, planJSON []byte, opts ...Option) error
- func Summary(w io.Writer, path string, opts ...Option) error
- type Option
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Run ¶
Run loads a Terraform plan from path and launches the interactive TUI, blocking until the user quits. path may be:
- a binary plan file from "terraform plan -out=plan.tfplan" — "terraform show -json" is invoked to render it (see WithTerraformPath),
- the JSON from "terraform show -json plan.tfplan", or
- "-" to read plan JSON from stdin.
func RunContext ¶
RunContext is Run with a context: cancelling ctx tears the UI down and returns. Normal quit (q / Ctrl-C) is unaffected. Use it when embedding the explorer in a longer-lived program that owns signal handling or a deadline.
func RunJSON ¶
RunJSON launches the interactive TUI on plan JSON (the output of "terraform show -json") that you already hold in memory, blocking until the user quits. The source label defaults to "plan"; override it with WithPlanName.
func RunJSONContext ¶
RunJSONContext is RunJSON with a context; see RunContext for the semantics.
Types ¶
type Option ¶
type Option func(*config)
Option configures Run, RunJSON, and Summary.
func WithAltScreen ¶
WithAltScreen controls whether the TUI takes over the full screen (the terminal's alternate screen buffer). The default is true; pass false to keep the plan in the normal scrollback.
func WithPlanName ¶
WithPlanName overrides the source label shown in the UI. By default this is the base name of the plan file ("stdin" for "-", or "plan" for RunJSON, which has no path to derive a name from).
func WithProgramOptions ¶
func WithProgramOptions(opts ...tea.ProgramOption) Option
WithProgramOptions appends extra Bubble Tea program options (for example tea.WithMouseCellMotion). The alternate-screen option is managed by WithAltScreen and should not be passed here.
func WithTerraformPath ¶
WithTerraformPath overrides the terraform binary used to render a *binary* plan file via "terraform show -json". By default "terraform" is looked up on PATH. It is ignored when the input is already plan JSON or stdin.
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
tfplantui
command
Command tfplantui is an interactive terminal UI for exploring a Terraform plan as a dependency graph with color-coded, expandable attribute diffs.
|
Command tfplantui is an interactive terminal UI for exploring a Terraform plan as a dependency graph with color-coded, expandable attribute diffs. |
|
internal
|
|
|
tfplan
Package tfplan parses the JSON output of `terraform show -json <planfile>` into a navigable domain model: a block-level dependency graph plus per-attribute before/after diffs.
|
Package tfplan parses the JSON output of `terraform show -json <planfile>` into a navigable domain model: a block-level dependency graph plus per-attribute before/after diffs. |
