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

This creates diagram.html in the current directory.

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

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 No Output HTML file path (default: diagram.html)
-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.2.tar.gz (35.1 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.2-py3-none-any.whl (35.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: terraformgraph-1.0.2.tar.gz
  • Upload date:
  • Size: 35.1 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.2.tar.gz
Algorithm Hash digest
SHA256 e13007c1c2271ef599442f766ce1ade745f2fd037f906145a2881b66ec0db60a
MD5 03fa3a5f31bb0e51cd57f21e465e51d6
BLAKE2b-256 344bc182a45cb741ec5b27317ed232e36e48776c190da014947e8c8242feb8c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: terraformgraph-1.0.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 3a1e852928958ed12f0d4bed033a77bd04d56bbe0435d07a8e3b0e02cf5f1920
MD5 35bdc9557d2c9d9db63377fde7dd41e6
BLAKE2b-256 1164945ffdb4aa8893ecfcc80cf0104694873e79cd6ad8d94c810f58bd59ae14

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