Skip to main content

TfBrief

PyPI version Python

TfBrief is a dependency-free Python package that formats terraform show -json into human-readable CI logs and Markdown for pull-request reviews: summary panels, resource actions, and attribute diffs—no jq scripts and no third-party runtime deps (stdlib only).

  • Terraform / OpenTofu plan formatter for pipelines and PR comments
  • --format markdown for GITHUB_STEP_SUMMARY and issue comments
  • pip install tfbrief — one pipe on stdout; optional --has-changes apply gate

Canonical docs: this README on GitHub main. PyPI copies it on each release (push a v*.*.* tag after merging doc changes).

Install from PyPI: pypi.org/project/tfbrief

Example output (fixture minimal-plan.json)
TfBrief terminal output: summary, resource actions, and attribute diffs

Why TfBrief?

Hashicorp’s JSON plan is complete but awkward in pull request checks and pipeline logs. TfBrief is a small Python CLI focused on infrastructure-as-code workflows: operators see what will create, update, or delete before apply, without a JSON viewer or custom jq scripts.

Typical fit: Terraform modules in GitHub Actions, GitLab CI, or any job that already runs terraform plan -out=tfplan.

OpenTofu

OpenTofu uses the same JSON plan shape as Terraform. Pipe tofu show -json tfplan into TfBrief the same way as terraform show -json.

Install

pip install tfbrief

Requires Python 3.10+. The tfbrief command is on your PATH after install.

Contributors (editable install from a clone):

pip install -e .

Usage

After terraform plan -out=tfplan, pipe the JSON plan into TfBrief:

terraform show -json tfplan | tfbrief

That prints the summary panel, resource table, and attribute diffs (see example above).

Markdown (pull request summaries)

For PR comments or GITHUB_STEP_SUMMARY, emit Markdown instead of ANSI terminal output:

terraform show -json tfplan | tfbrief --format markdown

Short form: --format=markdown or --format md.

Saving Markdown to a file on Windows: In Windows PowerShell 5.1, > / >> use Unicode (often UTF-16 LE), not the process stdout encoding — PYTHONIOENCODING alone does not fix that. Prefer one of:

Get-Content plan.json | python -m tfbrief --format markdown | Out-File -Encoding utf8 plan-summary.md
# Git Bash or WSL
terraform show -json tfplan | tfbrief --format markdown > plan-summary.md

See about_Character_Encoding. Linux runners (GITHUB_STEP_SUMMARY, >>) use UTF-8 by default.

Markdown in another repo: copy docs/examples/pr-plan-summary.yml into .github/workflows/. The default install is pip install tfbrief from PyPI; optional env vars install from a Git ref for prerelease testing.

Optional: --has-changes (apply gate)

Same JSON input, different output — no formatted report. Stdout is only true or false so scripts can skip apply when the plan is empty:

terraform show -json tfplan | tfbrief --has-changes
# true

Plans with only no-op / read actions (and no output changes) print false. Resource or output changes print true. Invalid JSON prints an error to stderr and exits 1.

Typical pattern — log for humans, gate for apply:

terraform plan -out=tfplan
terraform show -json tfplan | tfbrief
if [ "$(terraform show -json tfplan | tfbrief --has-changes)" = "true" ]; then
  terraform apply tfplan
fi

You do not need --has-changes if you only want readable CI logs or apply manually.

GitHub Actions

- uses: actions/setup-python@v5
  with:
    python-version: "3.12"
- run: pip install -q tfbrief && terraform show -json tfplan | tfbrief

Post a Markdown plan summary on pull requests: use docs/examples/pr-plan-summary.yml. It appends to GITHUB_STEP_SUMMARY, updates one PR comment (marker <!-- tfbrief-plan-summary:v1 -->), skips comments on fork PRs (read-only token), and tolerates comment permission errors.

Or append to the job summary:

- run: |
    echo '## Terraform plan' >> $GITHUB_STEP_SUMMARY
    terraform show -json tfplan | tfbrief --format markdown >> $GITHUB_STEP_SUMMARY

Add --has-changes in a separate step only when a later step should run terraform apply conditionally.

Security

TfBrief redacts values when:

  • Terraform marks them in before_sensitive / after_sensitive, or
  • The attribute path looks secret-like (password, token, api_key, client_secret, connection_string, and similar).

Redaction is best-effort (naming heuristics miss custom fields). Treat all CI and PR output as sensitive; use Terraform sensitive = true on values that must not appear in logs.

License

MIT — see LICENSE.

Metadata

Release files for tfbrief 0.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tfbrief 0.1.6
File Size Uploaded Provenance Actions
tfbrief-0.1.6.tar.gz 21.3 kB With provenance Details for tfbrief-0.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tfbrief 0.1.6
File Interpreter ABI Platform Actions
tfbrief-0.1.6-py3-none-any.whl Python 3 none any Details for tfbrief-0.1.6-py3-none-any.whl

Total release size: 32.5 kB

Release files / tfbrief-0.1.6.tar.gz

Download URL tfbrief-0.1.6.tar.gz
Size 21.3 kB
Tags Source
SHA-256 checksum
How to use checksums
e7e11021594a5cd74cc46b52c1c9192171f5b3304ea9db8d1d03668bff812659
BLAKE2b-256 checksum
How to use checksums
3af2e3630006cd931736d71e6bcffe3bdbb61b81530d8b18397e2ac740062509
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Release files / tfbrief-0.1.6-py3-none-any.whl

Download URL tfbrief-0.1.6-py3-none-any.whl
Size 11.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
397aa7383a8c1fbd5fecb6be0eda92abd814df60d70867cc0a393cee141581c3
BLAKE2b-256 checksum
How to use checksums
b3ada6b92ca4573353a3a676eeffedb370d3d420d8e7964859891ce9566f05b0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

Security for tfbrief 0.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for tfbrief-0.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 29, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page