Advanced Terraform Intelligence & Analysis Suite
Project description
TFKit - Terraform Intelligence & Analysis Suite
A comprehensive toolkit for analyzing, visualizing, and validating Terraform infrastructure code. TFKit provides deep insights into your Terraform projects with advanced dependency tracking, security scanning, and interactive visualizations.
Overview
TFKit helps infrastructure teams understand, validate, and optimize their Terraform configurations through:
- Detailed Analysis: Deep dependency mapping and resource relationship tracking
- Multi-Format Export: Flexible output formats for integration with other tools
- Interactive Visualizations: Rich graphical representations of your infrastructure
- Security Validation: Built-in security scanning and compliance checks
- CI/CD Ready: SARIF output and automation-friendly interfaces
Quick Start
Installation
pip install tfkit-py
Basic Usage
Get started with these common commands:
# Quick project scan
tfkit scan
# Deep analysis with all features
tfkit analyze --deep --include-dependencies --include-security --include-costs
# Generate interactive report
tfkit report --interactive --open
# Validate configurations
tfkit validate --all --strict
Visualizations
TFKit provides multiple visualization layouts to suit different analysis needs:
| Graph Layout | Dashboard Layout | Classic Layout |
|---|---|---|
| Force-directed graph showing resource relationships | Dashboard with metrics and insights | Traditional hierarchical layout |
Command Reference
Scan Command
Quick analysis for rapid insights into your Terraform project.
tfkit scan [PATH] [OPTIONS]
Examples:
# Scan current directory
tfkit scan
# Scan with JSON output
tfkit scan /path/to/terraform --format json
# Scan and open visualization
tfkit scan --open --theme dark --layout graph
Analyze Command
Deep analysis with detailed feature set for detailed infrastructure understanding.
tfkit analyze [PATH] [OPTIONS]
Key Options:
--deep, -d- Enable deep analysis with dependency tracking--include-dependencies, -D- Analyze module dependencies--include-security, -S- Include security analysis--include-costs, -C- Include cost estimation--export-json FILE- Export analysis as JSON--export-markdown FILE- Generate Markdown report
Examples:
# Full analysis with all features
tfkit analyze --deep -D -S -C --open-browser
# Security-focused analysis
tfkit analyze --include-security --export-markdown security-report.md
# AWS-specific analysis
tfkit analyze --providers aws --tags production
Inspect Command
Detailed inspection of specific Terraform components with dependency tracking.
tfkit inspect COMPONENT_TYPE [PATH] [OPTIONS]
Available Component Types:
resource- Terraform resourcesmodule- Module configurationsvariable- Input variablesoutput- Output valuesprovider- Provider configurationsdata- Data sourceslocal- Local valuesterraform- Terraform configuration blocks
Examples:
# Inspect all resources
tfkit inspect resource
# Inspect specific resource with dependencies
tfkit inspect resource --name aws_instance.web --show-dependencies
# Inspect modules with detailed metadata
tfkit inspect module --show-attributes --show-metadata --format table
Report Command
Generate detailed reports in multiple formats with customizable themes.
tfkit report [PATH] [OPTIONS]
Report Types:
summary- High-level overview (default)detailed- Detailed analysissecurity- Security and compliance focuscost- Cost analysis and optimizationcompliance- Compliance and best practices
Output Formats:
html- Interactive HTML (default)pdf- PDF documentmarkdown- Markdown documentjson- Structured JSON data
Examples:
# Interactive HTML report
tfkit report --type detailed --interactive --open
# PDF security report
tfkit report --type security --format pdf -o security-report.pdf
# Custom themed report
tfkit report --title "Production Infrastructure" --theme cyber
Export Command
Export analysis data in multiple structured formats for integration with other tools.
tfkit export [PATH] [OPTIONS]
Supported Formats:
json- JSON format (standard)yaml- YAML format (human-readable)csv- CSV format (spreadsheet-compatible)xml- XML format (legacy systems)toml- TOML format (config files)
Examples:
# Export as JSON and YAML
tfkit export --format json --format yaml
# Split exports by provider
tfkit export --format csv --split-by provider
# Export with compression
tfkit export --format json --format yaml --compress
Validate Command
Comprehensive validation of Terraform configurations with multiple check types.
tfkit validate [PATH] [OPTIONS]
Validation Checks:
--check-syntax- HCL syntax validation--check-references- Reference validation--check-best-practices- Best practices compliance--check-security- Security configuration checks--all, -a- Run all validation checks
Examples:
# Full validation suite
tfkit validate --all
# CI/CD integration with SARIF output
tfkit validate --all --strict --fail-on-warning --format sarif
# Targeted validation
tfkit validate --check-syntax --check-references --check-security
Advanced Usage
Complete Analysis Pipeline
# 1. Initial project scan
tfkit scan --save initial-scan.json
# 2. Deep analysis with all features
tfkit analyze --deep -D -S -C --export-json detailed.json
# 3. Generate comprehensive report
tfkit report --type detailed --include-graph --open
# 4. Export data for external tools
tfkit export --format json --format yaml --compress
Security-Focused Workflow
# Security analysis and data collection
tfkit analyze --include-security --export-json security-data.json
# Security validation
tfkit validate --check-security --strict
# Security report generation
tfkit report --type security --format pdf
CI/CD Integration
# Pre-commit validation
tfkit validate --check-syntax --check-references --fail-on-warning
# SARIF output for GitHub Actions
tfkit validate --all --format sarif > results.sarif
# Automated scanning
tfkit scan --quiet --format json --save scan-results.json
Configuration Management
# View current configuration
tfkit config --show
# Set default theme
tfkit config --set theme=dark
# Set default output format
tfkit config --set default_format=json
# Edit configuration in default editor
tfkit config --edit
Visualization Features
Available Themes
- Dark (default) - Dark theme for extended viewing sessions
- Light - Light theme for printed reports and documentation
- Cyber - High-contrast theme for presentations
- Nord - Nord color scheme for consistent styling
Layout Options
- Classic - Traditional hierarchical tree layout
- Graph - Force-directed graph for complex relationships
- Dashboard - Metrics-focused layout with key insights
Project Structure
tfkit/
├── analyzer/ # Terraform analysis components
│ ├── models.py # Data models and types
│ └── terraform_analyzer.py
├── validator/ # Validation engine
│ ├── models.py # Validation models
│ └── validator.py # Core validation logic
├── visualizer/ # Visualization components
│ └── html_generator.py
├── cli/ # Command-line interface
│ └── main.py # CLI entry point
└── utils/ # Utility functions
Output Examples
Scan Results
$ tfkit scan
Analysis Summary
──────────────────────────────────────────────────
Category Count Details
──────────────────────────────────────────────────
Resources 24 aws_instance: 5
Data Sources 3
Modules 2 2 modules detected
Variables 12
Outputs 8
Providers 3 aws, null, template
──────────────────────────────────────────────────
Validation Results
$ tfkit validate --all
Validation Complete: 45 passed, 3 warnings, 1 errors
Errors
─────────────────────────────────────────────────────────────────────
Severity Category Rule Location Resource Message
─────────────────────────────────────────────────────────────────────
ERROR Security TF101 main.tf:15 Missing security group
─────────────────────────────────────────────────────────────────────
Development
Installation from Source
git clone https://github.com/ivasik-k7/tfkit.git
cd tfkit
pip install -e .
Running Tests
pytest tests/ -v
Building Documentation
pip install -r requirements-docs.txt
mkdocs serve
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
- Built with Rich for beautiful terminal output
- Uses Click for CLI framework
- Inspired by Terraform best practices and community tools
TFKit - Advanced Terraform analysis and visualization
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file tfkit_py-0.4.41.tar.gz.
File metadata
- Download URL: tfkit_py-0.4.41.tar.gz
- Upload date:
- Size: 126.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
058ca2070459132290ebb2c30557aa28a14158b61c6f77c4b50674cc87393b40
|
|
| MD5 |
c6ea5fd4d2fff26117f086d43951a428
|
|
| BLAKE2b-256 |
08d6a2990dc41d8ef39a993a19c55fa879c2f00085095c35423cd50d4213de3a
|
File details
Details for the file tfkit_py-0.4.41-py3-none-any.whl.
File metadata
- Download URL: tfkit_py-0.4.41-py3-none-any.whl
- Upload date:
- Size: 122.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2c04f2695d29b055dec7fceac48059ae675824522df2055c5e7476cdd5152c1e
|
|
| MD5 |
6473126629a6625048b6deaef325f700
|
|
| BLAKE2b-256 |
3bdda1742a4fabe523b2381cbb88ee5a4f8689a5d5a2d8a881634daa7fb31f47
|