Explain infrastructure diffs in plain English — fast.
Diffy is a tiny OSS CLI that turns Terraform plan output into a human-readable summary with risk flags (replace/delete/public exposure/IAM changes), so reviewers can answer:
“What’s changing, and how risky is it?”
No dashboards. No agent loops. No auto-remediation. Just clarity.
- ✅ Terraform plan JSON (
terraform show -json plan.out) - ✅ Markdown / text / JSON output
- ✅ CI-friendly exit codes via
--fail-on
Planned next:
- Helm diffs, Kubernetes manifests, Pulumi previews (not in v0.1)
go install github.com/sgr0691/diffy@latestgit clone https://github.com/sgr0691/diffy
cd diffy
make buildterraform plan -out=plan.out
diffy explain --from-plan plan.outterraform show -json plan.out > plan.json
diffy explain plan.jsondiffy explain plan.json --format md
diffy explain plan.json --format text
diffy explain plan.json --format jsonFail the build if Diffy finds anything high or critical:
diffy explain plan.json --fail-on highExit codes:
0= no findings at or above the threshold2= findings at or above the threshold1= runtime error (bad input, terraform missing, parse failure)
- Replacements (
delete + create) → high (or critical for stateful resources) - Deletes → high (or critical for stateful resources like RDS, S3, ElastiCache, EFS, EKS)
- Public exposure hints:
- SG ingress open to
0.0.0.0/0or::/0on common ports - internet-facing load balancers
- public IP association enabled
- SG ingress open to
- IAM changes:
- policy attachments
- policy document changes (best-effort path-based)
- Medium/low heuristics:
- impactful stateful updates (storage/engine/encryption-class signals)
- network routing/gateway changes
- tag-only updates
Diffy is intentionally conservative and includes "why flagged" notes.
# Build
make build
# Run against an example plan
./diffy explain examples/plan/replace.json
# Try different formats
./diffy explain examples/plan/delete_stateful.json --format text
./diffy explain examples/plan/benign_tags_only.json --format json
# CI gating — exits 2 when findings meet threshold
./diffy explain examples/plan/delete_stateful.json --fail-on high; echo "exit: $?"PRs welcome. If you’re adding a rule:
- add a sample plan JSON under
examples/ - add a golden test snapshot under
examples/expected/
MIT