Custom Templates

Use built-in templates or create your own with Scriban to format reports exactly how you need them.

all providers

tfplan2md uses the powerful Scriban templating engine, allowing you to completely customize the output. You can override templates for specific resource types or change the global layout.

Example Template (Scriban)

{{- # Custom template for azurerm_resource_group -}}
#### 📦 Resource Group: {{ resource.name }}

**Location:** `{{ resource.values.location }}`
{{ if resource.values.tags }}
**Tags:**
{{ for tag in resource.values.tags }}
- `{{ tag.key }}`: `{{ tag.value }}`
{{ end }}
{{ end }}

Capabilities

  • Resource-Specific Templates: Create a file named provider_resource_type.sbn to override rendering for that resource.
  • Global Layout: Customize the overall report structure.
  • Access to All Data: Templates have full access to the Terraform plan JSON data.
  • Helper Functions: Use built-in helpers for formatting, diffing, and logic.

Using Templates

Command
# Use built-in template
tfplan2md plan.json --template summary

# Use custom template file
tfplan2md plan.json --template /path/to/custom.sbn

Learn More

tfplan2md includes multiple built-in templates and supports fully custom Scriban templates for advanced scenarios.