TFPrettyPlan - Terraform Plan Beautifier

  • Home /
  • TFPrettyPlan - Terraform Plan Beautifier

TFPrettyPlan transforms complex Terraform plans into readable, well-formatted output that helps you understand infrastructure changes at a glance. No more squinting at messy JSON output or struggling with truncated values - TFPrettyPlan delivers clear, concise, and visually appealing plan summaries directly in your terminal.

The Problem: Unreadable Terraform Plans

Terraform’s native plan output can be difficult to parse, especially for complex infrastructure changes:

  • Long values get truncated in unhelpful ways
  • Table formatting breaks with wide content
  • Important information gets lost in the noise
  • JSON output is verbose and hard to scan quickly

For DevOps engineers and infrastructure teams, this creates friction in the review process, increases the risk of overlooking important changes, and slows down your deployment workflow.

The Solution: TFPrettyPlan

TFPrettyPlan is a lightweight CLI tool that parses Terraform plan JSON files and renders them in a beautifully formatted ASCII table. It intelligently highlights resources that will be created, updated, or deleted, making it easy to understand the impact of your changes before applying them.

Key Features

Dynamic Table Formatting

TFPrettyPlan automatically adjusts column widths based on your terminal size, ensuring optimal readability regardless of your environment. The tool offers:

  • Standard Format: Balanced column widths for everyday use
  • Wide Format: Expanded columns for viewing complex changes with longer values
  • Custom Width: Set your preferred display width for consistent output

Smart Truncation

Unlike Terraform’s default output that simply cuts off long values, TFPrettyPlan uses context-aware truncation that preserves the most important parts:

  • Path-like strings: Preserves beginning and end parts

    /very/long/path/with/many/nested/directories/file.txt → /very/long/.../file.txt
    
  • JSON-like values: Preserves structure

    {"key":"value","nested":{"prop":"too long to display fully"}} → {"key":"value","nested":{"prop":"too...}}
    
  • Long strings: Truncates middle to keep context

    This is a very long string that exceeds the column width → This is a...column width
    

Automatic Terminal Width Detection

TFPrettyPlan automatically detects your terminal width and optimizes the display accordingly:

  • Dynamically adjusts column widths for optimal readability
  • Ensures tables fit within your terminal window
  • Provides consistent formatting across different environments

Color-Coded Changes

Quickly identify the type of changes with intuitive color coding:

  • Green: Resources to be created
  • Yellow: Resources to be updated
  • Red: Resources to be deleted
  • Blue: No-op changes (resources that won’t change)

Comprehensive Change Details

For each resource being modified, TFPrettyPlan shows:

  • Resource address and type
  • Detailed before/after values for each changed attribute
  • Summary statistics of total changes by type

Installation and Usage

Quick Installation

Install the latest version with our one-liner script:

curl -s https://raw.githubusercontent.com/ao/tfprettyplan/main/install.sh | bash

This script automatically:

  • Detects your OS and CPU architecture
  • Downloads the appropriate binary
  • Installs TFPrettyPlan into /usr/local/bin

Alternative Installation Methods

Using Go:

go install github.com/ao/tfprettyplan/cmd/tfprettyplan@latest

From Source:

git clone https://github.com/ao/tfprettyplan.git
cd tfprettyplan
go build -o tfprettyplan ./cmd/tfprettyplan

Basic Usage

TFPrettyPlan can read Terraform plan files in JSON format:

# Read from a file
tfprettyplan plan.json

# Using the -file flag
tfprettyplan -file plan.json

# Pipe from terraform show
terraform show -json plan.tfplan | tfprettyplan

Formatting Options

Customize the output to suit your needs:

# Use wider output format for better readability
tfprettyplan -wide plan.json

# Set a specific terminal width
tfprettyplan -width 120 plan.json

# Disable automatic width detection
tfprettyplan -no-auto-width plan.json

# Disable color output
tfprettyplan -no-color plan.json

Technical Specifications

System Requirements

  • Operating Systems: Linux, macOS, Windows
  • Architecture: x86_64, ARM64
  • Dependencies: None (single binary distribution)
  • Disk Space: < 10MB

Performance

  • Startup Time: < 100ms
  • Memory Usage: Minimal (~10MB)
  • Processing Speed: Handles plans with 1000+ resources efficiently

Integration

TFPrettyPlan integrates seamlessly with existing Terraform workflows:

  • Works with standard Terraform JSON plan output
  • Can be used in CI/CD pipelines
  • Compatible with all recent Terraform versions (0.12+)

Before and After Examples

Before: Standard Terraform Output

# aws_s3_bucket.logs will be updated in-place
~ resource "aws_s3_bucket" "logs" {
      id            = "log-bucket-12345"
      region        = "us-west-2"
    ~ acl           = "private" -> "public-read"
    ~ force_destroy = false -> true
    ~ tags          = {
        ~ "Name" = "Log Bucket" -> "Logs Bucket"
        }
    # (5 unchanged attributes hidden)
}

After: TFPrettyPlan Output

• aws_s3_bucket.logs (aws_s3_bucket)
  +---------------+------------------+------------------+
  |   ATTRIBUTE   |    OLD VALUE     |    NEW VALUE     |
  +---------------+------------------+------------------+
  | acl           | private          | public-read      |
  | force_destroy | false            | true             |
  | tags.Name     | Log Bucket       | Logs Bucket      |
  +---------------+------------------+------------------+

Complex Example with Smart Truncation

Before: Values get cut off abruptly

# aws_lambda_function.processor will be updated in-place
~ resource "aws_lambda_function" "processor" {
    ~ environment = {
        ~ variables = {
            ~ "CONFIG_PATH" = "/var/config/processing/settings/development/app_config.json" -> "/var/config/processing/settings/production/app_config.json"
            # (3 unchanged elements hidden)
          }
      }
    # (8 unchanged attributes hidden)
}

After: TFPrettyPlan preserves important parts

 aws_lambda_function.processor (aws_lambda_function)
  +---------------+--------------------------------+--------------------------------+
  |   ATTRIBUTE   |           OLD VALUE            |           NEW VALUE            |
  +---------------+--------------------------------+--------------------------------+
  | environment.  | /var/config/processing/.../    | /var/config/processing/.../    |
  | variables.    | development/app_config.json    | production/app_config.json     |
  | CONFIG_PATH   |                                |                                |
  +---------------+--------------------------------+--------------------------------+

Download & Resources

Get TFPrettyPlan

Installation Methods

  • Script (Recommended): curl -s https://raw.githubusercontent.com/ao/tfprettyplan/main/install.sh | bash
  • Go Install: go install github.com/ao/tfprettyplan/cmd/tfprettyplan@latest
  • Binary Downloads: Available for Linux, macOS, and Windows on the releases page

Support & Community


Enhance your Terraform workflow today with TFPrettyPlan - because infrastructure changes should be easy to understand.