Skip to content

How to Generate a Markdown Report

This guide shows you how to generate a Markdown report from a Terraform plan JSON file.

Prerequisites


Produce the Terraform plan JSON

If you have not already exported your plan to JSON, do it now:

terraform plan -out=tfplan
terraform show -json tfplan > plan.json

Generate and print to stdout

Pass the JSON file as the positional argument to tf-peek generate:

tf-peek generate plan.json

The Markdown report is printed to stdout. You can pipe it to any tool that accepts Markdown.


Save to a file

To write the report to a file instead of printing it, use --output (short form: -o):

tf-peek generate plan.json --output report.md

If the file already exists, tf-peek will overwrite it and print a notice:

Overwriting report.md
Report written to report.md

Use a custom configuration file

By default tf-peek looks for peek_config.toml in the current working directory. To point it at a different file, use --config (short form: -c):

tf-peek generate plan.json --config path/to/my-config.toml

If neither the default file nor the specified file exists, tf-peek proceeds with an empty configuration (all resources are classified as normal).


Combine options

Options can be combined freely:

tf-peek generate plan.json \
  --config infra/peek_config.toml \
  --output reports/$(date +%Y%m%d).md

See also