# README
tfplandoc - a tool to generate Terraform plan documentation
This tool generates documentation for Terraform plans. It reads the plan file and generates a markdown file with the resources that will be created, updated, or deleted.
Installation
Download the compiled release from the releases page, or install it using go install
:
go install github.com/matt-FFFFFF/tfplandoc@latest
Usage
First generate a plan file using terraform plan -out <file>
, then convert to JSON using terraform show -json
.
Finally, run tfplandoc
with the plan file as an argument:
terraform plan -out tfplan && terraform show -json tfplan >tfplan.json
tfplandoc generate tfplan.json
You can also pipe the output of terraform show -json
directly to tfplandoc
:
terraform plan -out tfplan && terraform show -json tfplan | tfplandoc generate -
Output key
To show the key for the output changes, use the --help
or -h
flag:
Generates documentation from the Terraform plan output. Has resource creations, modifications and deletions.
Key:
š¢ - Create
šµ - Read
š - Update
š“ - Delete
āŖ - Noop
š£ - Forget (remove form state but do not destroy)
Usage:
tfplandoc generate [flags]
Examples:
tfplandoc generate /path/to/terraform/plan.json
Flags:
-a, --all Generate output for all resources, even with no changes
-h, --help help for generate
-t, --text Output in plain text, without symbols and color
Showing all output
By default, the tool will only show resources and outputs that have changes.
To show all resources and outputs, use the --all
flag:
tfplandoc generate tfplan.json --all
Example output (plain text)
#### Resource Changes
| RESOURCE | CHANGE |
|-----------------------------------------------------------------------------------------------------------------|--------|
| module.management.azapi_resource.data_collection_rule["change_tracking"] | š¢ |
| module.management.azapi_resource.data_collection_rule["defender_sql"] | š¢ |
| module.management.azapi_resource.data_collection_rule["vm_insights"] | š¢ |
| module.management.azapi_resource.sentinel_onboarding[0] | š¢ |
| module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/AgentHealthAssessment"] | š“ |
| module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/AntiMalware"] | š“ |
| module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/ChangeTracking"] | š“ |
| module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/SQLAdvancedThreatProtection"] | š“ |
| module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/SQLAssessment"] | š“ |
| module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/SQLVulnerabilityAssessment"] | š“ |
| module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/Security"] | š“ |
| module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/ServiceMap"] | š“ |
| module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/Updates"] | š“ |
| module.management.azurerm_log_analytics_solution.security_insights_for_removal | š£ |
| module.management.azurerm_user_assigned_identity.management["ama"] | š¢ |
#### Output Changes
| OUTPUT | CHANGE |
|-------------------------------|--------|
| test_data_collection_rule_ids | š¢ |
| test_managed_identity_ids | š¢ |
Plan file: tfplan.json
Example output (formatted)
Resource Changes
RESOURCE | CHANGE |
---|---|
module.management.azapi_resource.data_collection_rule["change_tracking"] | š¢ |
module.management.azapi_resource.data_collection_rule["defender_sql"] | š¢ |
module.management.azapi_resource.data_collection_rule["vm_insights"] | š¢ |
module.management.azapi_resource.sentinel_onboarding[0] | š¢ |
module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/AgentHealthAssessment"] | š“ |
module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/AntiMalware"] | š“ |
module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/ChangeTracking"] | š“ |
module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/SQLAdvancedThreatProtection"] | š“ |
module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/SQLAssessment"] | š“ |
module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/SQLVulnerabilityAssessment"] | š“ |
module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/Security"] | š“ |
module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/ServiceMap"] | š“ |
module.management.azurerm_log_analytics_solution.management["Microsoft/OMSGallery/Updates"] | š“ |
module.management.azurerm_log_analytics_solution.security_insights_for_removal | š£ |
module.management.azurerm_user_assigned_identity.management["ama"] | š¢ |
Output Changes
OUTPUT | CHANGE |
---|---|
test_data_collection_rule_ids | š¢ |
test_managed_identity_ids | š¢ |
Plan file: tfplan.json
# Packages
Copyright Ā© 2023 NAME HERE <EMAIL ADDRESS>
*/.