Skip to content

Summarize terragrunt "run-all show -json tfplan" output

License

Notifications You must be signed in to change notification settings

krmcbride/tg-summarize

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tg-summarize

A CLI tool to parse and summarize Terraform show JSON output from Terragrunt's run-all command, with detailed attribute-level change tracking.

Motivation

This project was inspired by tf-summarize, which doesn't have proper multi-module Terragrunt support. tg-summarize provides a clean, colorized tree view showing which modules and specific attributes would change when applying your infrastructure.

Installation

Install to ~/.local/bin

git clone https://github.com/krmcbride/tg-summarize.git
cd tg-summarize
make install

This will build the binary and install it to ~/.local/bin/tg-summarize. Make sure ~/.local/bin is in your PATH.

Build from source

git clone https://github.com/krmcbride/tg-summarize.git
cd tg-summarize
make build

The binary will be created at dist/tg-summarize.

Usage

tg-summarize parses Terraform show JSON format with detailed before/after attribute tracking:

# Generate plan file
terragrunt run-all plan -out=tfplan

# Generate and summarize show output
terragrunt run-all show -json tfplan | tg-summarize

Or save the show output to a file:

terragrunt run-all show -json tfplan > plan-show.json
tg-summarize < plan-show.json

Output Modes

Default mode: Tree view with attribute-level changes

terragrunt run-all show -json tfplan | tg-summarize

Example output:

Terragrunt Plan
════════════════════════════════════════════════════════════

eks_cluster (+1 ~1 -1)
└─ module
   └─ eks_cluster
      ├─ aws_eks_cluster
      │  └─ eks ~
      │     Changed attributes:
      │       • version: 1.32 → 1.33
      └─ null_resource
         └─ wait_for_api ±

helm_release (+0 ~1 -0)
└─ helm_release
   └─ karpenter ~
      Changed attributes:
        • repository_password: (sensitive value changed)

════════════════════════════════════════════════════════════
Summary: 4 modules with changes, +4 ~3 -3

Summary mode: High-level statistics only

terragrunt run-all show -json tfplan | tg-summarize --summary

Example output:

Terragrunt Plan Summary
════════════════════════════════════════════════════════════
Total modules analyzed: 22
Modules with changes:   4
Modules without changes: 18

Total changes:
  Resources to add:    4
  Resources to change: 3
  Resources to remove: 3

Overall: +4 ~3 -3

Options

  • --summary: Show only high-level summary statistics
  • --no-color: Disable colored output
  • --version: Show version information

Color Scheme

  • Green (+): Resources/values being added
  • Yellow (~): Resources to be changed/updated
  • Yellow (±): Resources to be replaced
  • Red (-): Resources/values being removed
  • Blue: Module names
  • Cyan: Attribute paths and structural information
  • Red → Green: Before/after value changes (old value in red, new value in green)

Features

  • Attribute-level change tracking: Shows exactly what changed (e.g., version: 1.32 → 1.33)
  • Intelligent JSON diff: Automatically parses and compares complex JSON values (policies, configurations)
    • Structured diffs showing exact paths to changes (e.g., Statement[2].Principal.AWS)
    • Array comparison with positional matching for modified objects
    • Shows added/removed items in arrays with clear labeling
  • Sensitive field detection: Automatically masks passwords, secrets, tokens, and keys
  • Tree view: Clean hierarchical display of resource addresses
  • Smart module naming: Extracts the most prominent module name from each plan
  • Multi-module support: Handles Terragrunt run-all output with multiple modules
  • ✅ Filters out modules with no changes
  • ✅ Colorized terminal output for easy scanning (red/green diff style)
  • ✅ Multiple output modes (tree, summary)
  • ✅ Reads from stdin for easy piping
  • ✅ Filters out data source "read" operations (not actual infrastructure changes)

Requirements

  • Go 1.25+ (for building from source)
  • Terragrunt with OpenTofu or Terraform

Development

Setup

Install development tools (formatters, linters):

make tools

Common Tasks

# Format code
make fmt

# Run linter
make lint

# Run tests
make test

# Build binary
make build

# Install to ~/.local/bin
make install

Individual Development Tools

# Install specific tools
make tool-gofumpt           # Code formatter
make tool-goimports-reviser # Import formatter
make tool-golangci-lint     # Linter

License

MIT

About

Summarize terragrunt "run-all show -json tfplan" output

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published