- Parses Terraform plan JSON files
- Displays a summary of resources to be created, updated, or deleted
- Shows detailed information about each resource change
- Highlights changes with color (can be disabled)
- Supports reading from files or standard input
- Enhanced table formatting with dynamic column sizing
- Smart truncation for long values that preserves important parts
- Multiple output width options to accommodate different content lengths
- Automatic terminal width detection for optimal display
Run this one-liner to install the latest version for your OS and architecture:
curl -s https://raw.githubusercontent.com/ataiva-software/tfprettyplan/main/install.sh | bashThis script:
- Detects your OS and CPU
- Fetches the latest release from GitHub
- Installs tfprettyplan into /usr/local/bin
You can inspect the script here.
For Windows, download the ZIP file from the releases page and extract it to a location in your PATH.
If you have Go installed, you can install TFPrettyPlan directly:
go install github.com/ataiva-software/tfprettyplan/cmd/tfprettyplan@latestgit clone https://github.com/ataiva-software/tfprettyplan.git
cd tfprettyplan
go build -o tfprettyplan ./cmd/tfprettyplanTFPrettyPlan can read Terraform plan files in JSON format. You can provide the plan file as an argument or pipe the JSON data to the tool.
# 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# 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
# Combine options as needed
tfprettyplan -wide -no-color plan.json-file, -f: Path to Terraform plan JSON file-no-color: Disable color output-version, -v: Show version information-wide,-w: Use wider output format for better readability of long values-width: Set a fixed terminal width (overrides auto-detection)-no-auto-width: Disable automatic terminal width detection
To use TFPrettyPlan with a Terraform plan:
-
Generate a Terraform plan file:
terraform plan -out=plan.tfplan
-
Convert the plan to JSON:
terraform show -json plan.tfplan > plan.json -
Use TFPrettyPlan to visualize the plan:
tfprettyplan plan.json
Or in a single command:
terraform show -json plan.tfplan | tfprettyplan
Terraform Plan Summary
=====================
+--------+-------+
| ACTION | COUNT |
+--------+-------+
| Create | 2 |
| Update | 1 |
| Delete | 1 |
| Total | 4 |
+--------+-------+
Resources to Create
==================
• aws_instance.example (aws_instance)
• aws_security_group.allow_ssh (aws_security_group)
Resources to Update
==================
• 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 |
+---------------+------------------+------------------+
Resources to Delete
==================
• aws_iam_role.lambda (aws_iam_role)
• 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 |
+---------------+------------------+------------------+
• aws_s3_bucket.logs (aws_s3_bucket)
+---------------+--------------------------------+--------------------------------+
| ATTRIBUTE | OLD VALUE | NEW VALUE |
+---------------+--------------------------------+--------------------------------+
| acl | private | public-read |
| force_destroy | false | true |
| tags.Name | Log Bucket with a longer name | Logs Bucket with details |
| description | This is a short description... | This is a longer description...|
+---------------+--------------------------------+--------------------------------+
For long values, TFPrettyPlan uses smart truncation to preserve 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
This is a very long string that exceeds the column width → This is a...column width
TFPrettyPlan uses semantic versioning and automated releases:
- New releases are automatically created when code is pushed to the main branch
- Releases follow semantic versioning (MAJOR.MINOR.PATCH)
- Each release includes pre-built binaries for all supported platforms
- Release notes are automatically generated from commit messages
You can find all releases on the GitHub Releases page.
TFPrettyPlan includes a comprehensive test suite to ensure the reliability and correctness of its functionality.
To run the tests, use the standard Go testing tools:
# Run all tests
go test ./...
# Run tests for a specific package
go test ./pkg/parser
go test ./pkg/renderer
go test ./pkg/config
go test ./pkg/terminal
# Run tests with verbose output
go test -v ./...
# Run tests with coverage report
go test -cover ./...
# Generate a detailed HTML coverage report
go test -coverprofile=coverage.out ./...
go tool cover -html=coverage.out -o coverage.htmlIf you're contributing to TFPrettyPlan, please ensure that your changes are covered by tests. Each package has its own test file(s) that follow Go's standard testing conventions.
Test files are named with the _test.go suffix and are located in the same directory as the code they test.
Contributions are welcome! Please feel free to submit a Pull Request.
For commit messages, we follow Conventional Commits format:
feat: add new feature
fix: fix a bug
docs: update documentation
refactor: code refactoring without functionality changes
This helps with automatic versioning and changelog generation.
- Fork the repository
- Create a new branch for your feature or bug fix
- Write tests for your changes
- Implement your changes
- Ensure all tests pass
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
