Document IaC Command¶
Overview¶
The document iac command generates comprehensive documentation for Infrastructure as Code projects using terraform-docs and AI-powered documentation generation.
Usage¶
# Basic documentation generation
thothctl document iac -f terraform-terragrunt
# Recursive documentation
thothctl document iac -f terraform-terragrunt --recursive
# Custom configuration
thothctl document iac -f terraform --config-file .terraform-docs.yml
Features¶
- Automatic Documentation: Generate README files for modules
- Terraform-docs Integration: Professional module documentation
- AI-Powered Docs: Generative AI documentation creation
- Graph Generation: Dependency graphs in SVG or Mermaid format
- Multi-Framework Support: Terraform, Terragrunt, CDK
- Dependency Visualization: Show module relationships with input/output details
- Professional Styling: Color-coded graphs with ThothCTL branding
Supported Frameworks¶
- terraform: Pure Terraform projects
- terragrunt: Terragrunt-based projects
- terraform-terragrunt: Mixed environments
Output¶
The command generates: - README.md files for each module - Dependency graphs (SVG or Mermaid format) - Input/output documentation with mock_outputs details - Usage examples - Visual dependency relationships
Graph Formats¶
SVG (--graph-type dot): - Interactive vector graphics - Scalable and zoomable - Best for local viewing
Mermaid (--graph-type mermaid): - Text-based diagrams - Version control friendly - Renders in GitHub/GitLab - Shows input keys on edges - Color-coded by complexity
Examples¶
Generate Module Documentation¶
Recursive Documentation¶
Custom Configuration¶
Generate Dependency Graphs¶
SVG Graph (Default):
Output:graph.svg with visual dependency tree
Mermaid Graph:
Output:graph.mmd with text-based diagram showing:
- Module dependencies
- Input keys from mock_outputs
- Color-coded complexity
Example Mermaid Output:
graph LR
vpc["<b>vpc</b>"]:::rootNode
app["<b>app</b><br/><small>📥 vpc: vpc_id, subnet_ids</small>"]:::normalNode
app -->|vpc_id, subnet_ids| vpc
From Subdirectory¶
Shows current module and its dependencies with relative pathsRelated Commands¶
check iac- Validate structureinventory iac- Create inventoryscan iac- Security scanning