terraformgraph 1.0.1__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 [Your Name]
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,161 @@
1
+ Metadata-Version: 2.4
2
+ Name: terraformgraph
3
+ Version: 1.0.1
4
+ Summary: Generate interactive architecture diagrams from Terraform configurations
5
+ Author-email: Your Name <your.email@example.com>
6
+ License: MIT
7
+ Project-URL: Homepage, https://github.com/ferdinandobons/terraformgraph
8
+ Project-URL: Documentation, https://github.com/ferdinandobons/terraformgraph#readme
9
+ Project-URL: Repository, https://github.com/ferdinandobons/terraformgraph.git
10
+ Project-URL: Issues, https://github.com/ferdinandobons/terraformgraph/issues
11
+ Keywords: terraform,infrastructure,diagram,aws,visualization,architecture,terraformgraph
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Environment :: Console
14
+ Classifier: Intended Audience :: Developers
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: License :: OSI Approved :: MIT License
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.9
20
+ Classifier: Programming Language :: Python :: 3.10
21
+ Classifier: Programming Language :: Python :: 3.11
22
+ Classifier: Programming Language :: Python :: 3.12
23
+ Classifier: Topic :: Software Development :: Documentation
24
+ Classifier: Topic :: System :: Systems Administration
25
+ Requires-Python: >=3.9
26
+ Description-Content-Type: text/markdown
27
+ License-File: LICENSE
28
+ Requires-Dist: python-hcl2>=4.3.0
29
+ Requires-Dist: PyYAML>=6.0
30
+ Provides-Extra: dev
31
+ Requires-Dist: pytest>=7.0; extra == "dev"
32
+ Requires-Dist: pytest-cov>=4.0; extra == "dev"
33
+ Requires-Dist: black>=23.0; extra == "dev"
34
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
35
+ Requires-Dist: mypy>=1.0; extra == "dev"
36
+ Requires-Dist: types-PyYAML>=6.0; extra == "dev"
37
+ Dynamic: license-file
38
+
39
+ # terraformgraph
40
+
41
+ Generate interactive architecture diagrams from your Terraform configurations. Supports AWS resources with automatic service grouping, relationship detection, and beautiful SVG/HTML output.
42
+
43
+ ![Example Diagram](docs/diagram.png)
44
+
45
+ ## Features
46
+
47
+ - **Automatic parsing** of Terraform HCL files
48
+ - **Smart resource grouping** into logical services (ECS, RDS, S3, etc.)
49
+ - **Relationship detection** based on resource references
50
+ - **Interactive HTML output** with drag-and-drop positioning
51
+ - **PNG/JPG export** directly from the browser
52
+ - **Customizable** via YAML configuration files
53
+ - **No cloud credentials required** - works entirely offline
54
+
55
+ ## Installation
56
+
57
+ ### From PyPI
58
+
59
+ ```bash
60
+ pip install terraformgraph
61
+ ```
62
+
63
+ ### From Source
64
+
65
+ ```bash
66
+ git clone https://github.com/ferdinandobons/terraformgraph.git
67
+ cd terraformgraph
68
+ pip install -e .
69
+ ```
70
+
71
+ ## Quick Start
72
+
73
+ ### Basic Usage
74
+
75
+ Generate a diagram from a Terraform directory:
76
+
77
+ ```bash
78
+ terraformgraph -t ./infrastructure -o diagram.html
79
+ ```
80
+
81
+ ### With Environment Subdirectories
82
+
83
+ If your Terraform is organized by environment:
84
+
85
+ ```bash
86
+ terraformgraph -t ./infrastructure -e prod -o prod-diagram.html
87
+ ```
88
+
89
+ ### With AWS Icons
90
+
91
+ For beautiful AWS service icons, download the [AWS Architecture Icons](https://aws.amazon.com/architecture/icons/) and extract them:
92
+
93
+ ```bash
94
+ terraformgraph -t ./infrastructure -i ./AWS_Icons -o diagram.html
95
+ ```
96
+
97
+ ## Command Line Options
98
+
99
+ | Option | Required | Description |
100
+ |--------|----------|-------------|
101
+ | `-t, --terraform` | Yes | Path to Terraform directory |
102
+ | `-e, --environment` | No | Environment subdirectory (dev, staging, prod) |
103
+ | `-i, --icons` | No | Path to AWS icons directory |
104
+ | `-o, --output` | Yes | Output HTML file path |
105
+ | `-v, --verbose` | No | Enable debug output |
106
+
107
+ ## Configuration
108
+
109
+ ### Custom Aggregation Rules
110
+
111
+ Create `~/.terraformgraph/aggregation_rules.yaml` to customize how resources are grouped:
112
+
113
+ ```yaml
114
+ compute:
115
+ my_custom_service:
116
+ primary: ["aws_my_resource"]
117
+ secondary: ["aws_my_helper"]
118
+ in_vpc: true
119
+ ```
120
+
121
+ ### Custom Connections
122
+
123
+ Create `~/.terraformgraph/logical_connections.yaml` to define service relationships:
124
+
125
+ ```yaml
126
+ connections:
127
+ - source: my_service
128
+ target: another_service
129
+ label: "Custom Connection"
130
+ type: data_flow
131
+ ```
132
+
133
+ ## Supported Resources
134
+
135
+ The tool supports 100+ AWS resource types including:
136
+
137
+ - **Compute**: ECS, EC2, Lambda, Auto Scaling
138
+ - **Networking**: VPC, ALB/NLB, Route53, CloudFront
139
+ - **Storage**: S3, EBS, EFS
140
+ - **Database**: RDS, DynamoDB, ElastiCache
141
+ - **Messaging**: SQS, SNS, EventBridge
142
+ - **Security**: IAM, KMS, Secrets Manager, WAF
143
+ - **And many more...**
144
+
145
+ ## Output
146
+
147
+ The generated HTML file includes:
148
+
149
+ - **Interactive diagram** with pan and zoom
150
+ - **Drag-and-drop** to reposition services
151
+ - **Click connections** to highlight data flows
152
+ - **Export buttons** for PNG and JPG
153
+ - **Save/Load layout** using browser storage
154
+
155
+ ## Contributing
156
+
157
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
158
+
159
+ ## License
160
+
161
+ MIT License - see [LICENSE](LICENSE) for details.
@@ -0,0 +1,123 @@
1
+ # terraformgraph
2
+
3
+ Generate interactive architecture diagrams from your Terraform configurations. Supports AWS resources with automatic service grouping, relationship detection, and beautiful SVG/HTML output.
4
+
5
+ ![Example Diagram](docs/diagram.png)
6
+
7
+ ## Features
8
+
9
+ - **Automatic parsing** of Terraform HCL files
10
+ - **Smart resource grouping** into logical services (ECS, RDS, S3, etc.)
11
+ - **Relationship detection** based on resource references
12
+ - **Interactive HTML output** with drag-and-drop positioning
13
+ - **PNG/JPG export** directly from the browser
14
+ - **Customizable** via YAML configuration files
15
+ - **No cloud credentials required** - works entirely offline
16
+
17
+ ## Installation
18
+
19
+ ### From PyPI
20
+
21
+ ```bash
22
+ pip install terraformgraph
23
+ ```
24
+
25
+ ### From Source
26
+
27
+ ```bash
28
+ git clone https://github.com/ferdinandobons/terraformgraph.git
29
+ cd terraformgraph
30
+ pip install -e .
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ### Basic Usage
36
+
37
+ Generate a diagram from a Terraform directory:
38
+
39
+ ```bash
40
+ terraformgraph -t ./infrastructure -o diagram.html
41
+ ```
42
+
43
+ ### With Environment Subdirectories
44
+
45
+ If your Terraform is organized by environment:
46
+
47
+ ```bash
48
+ terraformgraph -t ./infrastructure -e prod -o prod-diagram.html
49
+ ```
50
+
51
+ ### With AWS Icons
52
+
53
+ For beautiful AWS service icons, download the [AWS Architecture Icons](https://aws.amazon.com/architecture/icons/) and extract them:
54
+
55
+ ```bash
56
+ terraformgraph -t ./infrastructure -i ./AWS_Icons -o diagram.html
57
+ ```
58
+
59
+ ## Command Line Options
60
+
61
+ | Option | Required | Description |
62
+ |--------|----------|-------------|
63
+ | `-t, --terraform` | Yes | Path to Terraform directory |
64
+ | `-e, --environment` | No | Environment subdirectory (dev, staging, prod) |
65
+ | `-i, --icons` | No | Path to AWS icons directory |
66
+ | `-o, --output` | Yes | Output HTML file path |
67
+ | `-v, --verbose` | No | Enable debug output |
68
+
69
+ ## Configuration
70
+
71
+ ### Custom Aggregation Rules
72
+
73
+ Create `~/.terraformgraph/aggregation_rules.yaml` to customize how resources are grouped:
74
+
75
+ ```yaml
76
+ compute:
77
+ my_custom_service:
78
+ primary: ["aws_my_resource"]
79
+ secondary: ["aws_my_helper"]
80
+ in_vpc: true
81
+ ```
82
+
83
+ ### Custom Connections
84
+
85
+ Create `~/.terraformgraph/logical_connections.yaml` to define service relationships:
86
+
87
+ ```yaml
88
+ connections:
89
+ - source: my_service
90
+ target: another_service
91
+ label: "Custom Connection"
92
+ type: data_flow
93
+ ```
94
+
95
+ ## Supported Resources
96
+
97
+ The tool supports 100+ AWS resource types including:
98
+
99
+ - **Compute**: ECS, EC2, Lambda, Auto Scaling
100
+ - **Networking**: VPC, ALB/NLB, Route53, CloudFront
101
+ - **Storage**: S3, EBS, EFS
102
+ - **Database**: RDS, DynamoDB, ElastiCache
103
+ - **Messaging**: SQS, SNS, EventBridge
104
+ - **Security**: IAM, KMS, Secrets Manager, WAF
105
+ - **And many more...**
106
+
107
+ ## Output
108
+
109
+ The generated HTML file includes:
110
+
111
+ - **Interactive diagram** with pan and zoom
112
+ - **Drag-and-drop** to reposition services
113
+ - **Click connections** to highlight data flows
114
+ - **Export buttons** for PNG and JPG
115
+ - **Save/Load layout** using browser storage
116
+
117
+ ## Contributing
118
+
119
+ Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
120
+
121
+ ## License
122
+
123
+ MIT License - see [LICENSE](LICENSE) for details.
@@ -0,0 +1,83 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "terraformgraph"
7
+ version = "1.0.1"
8
+ description = "Generate interactive architecture diagrams from Terraform configurations"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ requires-python = ">=3.9"
12
+ authors = [
13
+ {name = "Your Name", email = "your.email@example.com"}
14
+ ]
15
+ keywords = [
16
+ "terraform",
17
+ "infrastructure",
18
+ "diagram",
19
+ "aws",
20
+ "visualization",
21
+ "architecture",
22
+ "terraformgraph"
23
+ ]
24
+ classifiers = [
25
+ "Development Status :: 4 - Beta",
26
+ "Environment :: Console",
27
+ "Intended Audience :: Developers",
28
+ "Intended Audience :: System Administrators",
29
+ "License :: OSI Approved :: MIT License",
30
+ "Operating System :: OS Independent",
31
+ "Programming Language :: Python :: 3",
32
+ "Programming Language :: Python :: 3.9",
33
+ "Programming Language :: Python :: 3.10",
34
+ "Programming Language :: Python :: 3.11",
35
+ "Programming Language :: Python :: 3.12",
36
+ "Topic :: Software Development :: Documentation",
37
+ "Topic :: System :: Systems Administration",
38
+ ]
39
+ dependencies = [
40
+ "python-hcl2>=4.3.0",
41
+ "PyYAML>=6.0",
42
+ ]
43
+
44
+ [project.optional-dependencies]
45
+ dev = [
46
+ "pytest>=7.0",
47
+ "pytest-cov>=4.0",
48
+ "black>=23.0",
49
+ "ruff>=0.1.0",
50
+ "mypy>=1.0",
51
+ "types-PyYAML>=6.0",
52
+ ]
53
+
54
+ [project.urls]
55
+ Homepage = "https://github.com/ferdinandobons/terraformgraph"
56
+ Documentation = "https://github.com/ferdinandobons/terraformgraph#readme"
57
+ Repository = "https://github.com/ferdinandobons/terraformgraph.git"
58
+ Issues = "https://github.com/ferdinandobons/terraformgraph/issues"
59
+
60
+ [project.scripts]
61
+ terraformgraph = "terraformgraph.main:main"
62
+
63
+ [tool.setuptools.packages.find]
64
+ where = ["."]
65
+ include = ["terraformgraph*"]
66
+
67
+ [tool.setuptools.package-data]
68
+ terraformgraph = ["config/*.yaml"]
69
+
70
+ [tool.black]
71
+ line-length = 100
72
+ target-version = ["py39", "py310", "py311", "py312"]
73
+
74
+ [tool.ruff]
75
+ line-length = 100
76
+
77
+ [tool.ruff.lint]
78
+ select = ["E", "F", "I", "N", "W"]
79
+ ignore = ["E501"]
80
+
81
+ [tool.pytest.ini_options]
82
+ testpaths = ["tests"]
83
+ python_files = ["test_*.py"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,19 @@
1
+ """terraformgraph - Create architecture diagrams from Terraform configurations."""
2
+
3
+ __version__ = "1.0.1"
4
+
5
+ from .aggregator import ResourceAggregator
6
+ from .config_loader import ConfigLoader
7
+ from .layout import LayoutEngine
8
+ from .parser import TerraformParser
9
+ from .renderer import HTMLRenderer, SVGRenderer
10
+
11
+ __all__ = [
12
+ "__version__",
13
+ "TerraformParser",
14
+ "ResourceAggregator",
15
+ "LayoutEngine",
16
+ "SVGRenderer",
17
+ "HTMLRenderer",
18
+ "ConfigLoader",
19
+ ]
@@ -0,0 +1,6 @@
1
+ """Entry point for running as a module: python -m terraform_diagram"""
2
+
3
+ from .main import main
4
+
5
+ if __name__ == '__main__':
6
+ main()