Skip to main content

Generate interactive architecture diagrams from Terraform configurations

Project description

terraformgraph

Generate interactive architecture diagrams from your Terraform configurations. Supports AWS resources with automatic service grouping, relationship detection, and beautiful SVG/HTML output.

Example Diagram

Features

  • Automatic parsing of Terraform HCL files
  • Smart resource grouping into logical services (ECS, RDS, S3, etc.)
  • Relationship detection based on resource references
  • Interactive HTML output with drag-and-drop positioning
  • PNG/JPG export directly from the browser
  • Customizable via YAML configuration files
  • No cloud credentials required - works entirely offline

Installation

From PyPI

pip install terraformgraph

From Source

git clone https://github.com/ferdinandobons/terraformgraph.git
cd terraformgraph
pip install -e .

Quick Start

Basic Usage

Generate a diagram from a Terraform directory:

terraformgraph -t ./infrastructure -o diagram.html

With Environment Subdirectories

If your Terraform is organized by environment:

terraformgraph -t ./infrastructure -e prod -o prod-diagram.html

With AWS Icons

For beautiful AWS service icons, download the AWS Architecture Icons and extract them:

terraformgraph -t ./infrastructure -i ./AWS_Icons -o diagram.html

Command Line Options

Option Required Description
-t, --terraform Yes Path to Terraform directory
-e, --environment No Environment subdirectory (dev, staging, prod)
-i, --icons No Path to AWS icons directory
-o, --output Yes Output HTML file path
-v, --verbose No Enable debug output

Configuration

Custom Aggregation Rules

Create ~/.terraformgraph/aggregation_rules.yaml to customize how resources are grouped:

compute:
  my_custom_service:
    primary: ["aws_my_resource"]
    secondary: ["aws_my_helper"]
    in_vpc: true

Custom Connections

Create ~/.terraformgraph/logical_connections.yaml to define service relationships:

connections:
  - source: my_service
    target: another_service
    label: "Custom Connection"
    type: data_flow

Supported Resources

The tool supports 100+ AWS resource types including:

  • Compute: ECS, EC2, Lambda, Auto Scaling
  • Networking: VPC, ALB/NLB, Route53, CloudFront
  • Storage: S3, EBS, EFS
  • Database: RDS, DynamoDB, ElastiCache
  • Messaging: SQS, SNS, EventBridge
  • Security: IAM, KMS, Secrets Manager, WAF
  • And many more...

Output

The generated HTML file includes:

  • Interactive diagram with pan and zoom
  • Drag-and-drop to reposition services
  • Click connections to highlight data flows
  • Export buttons for PNG and JPG
  • Save/Load layout using browser storage

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.

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

terraformgraph-1.0.1.tar.gz (35.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

terraformgraph-1.0.1-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

Details for the file terraformgraph-1.0.1.tar.gz.

File metadata

  • Download URL: terraformgraph-1.0.1.tar.gz
  • Upload date:
  • Size: 35.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for terraformgraph-1.0.1.tar.gz
Algorithm Hash digest
SHA256 14804f61bc291467aa73e8ab1651435082f62f025b3be876ccce7c89c2da806e
MD5 b208c880fd11d043162961a72046a8c2
BLAKE2b-256 9a508d0ec3e385df0ba5788d2b4f428434c4a1ad638e537c2e6d21da1dcac09f

See more details on using hashes here.

File details

Details for the file terraformgraph-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: terraformgraph-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 35.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for terraformgraph-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54b1aa21752e2b1eb5de194a5bd00161cceb26349c6667db47a7038435fc31c4
MD5 c2798cba45a6882de2a1dbe8bb259009
BLAKE2b-256 df03282dd5fd34d6e5723cb366535d600dd85936439bb4dfed03a1271e849833

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page