tfplandoc

command module
v0.4.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 1 Imported by: 0

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

Documentation ΒΆ

Overview ΒΆ

Copyright Β© 2023 NAME HERE <EMAIL ADDRESS>

Directories ΒΆ

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL