tf-mcp 0.3.0__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.
- tf_mcp-0.3.0/.gitignore +24 -0
- tf_mcp-0.3.0/CLAUDE.md +24 -0
- tf_mcp-0.3.0/LICENSE +21 -0
- tf_mcp-0.3.0/PKG-INFO +146 -0
- tf_mcp-0.3.0/README.md +124 -0
- tf_mcp-0.3.0/pyproject.toml +33 -0
- tf_mcp-0.3.0/src/tf_mcp/__init__.py +0 -0
- tf_mcp-0.3.0/src/tf_mcp/clouds/__init__.py +1 -0
- tf_mcp-0.3.0/src/tf_mcp/clouds/aws.py +157 -0
- tf_mcp-0.3.0/src/tf_mcp/clouds/azure.py +121 -0
- tf_mcp-0.3.0/src/tf_mcp/clouds/gcp.py +31 -0
- tf_mcp-0.3.0/src/tf_mcp/codegen.py +369 -0
- tf_mcp-0.3.0/src/tf_mcp/dependencies.py +138 -0
- tf_mcp-0.3.0/src/tf_mcp/models.py +74 -0
- tf_mcp-0.3.0/src/tf_mcp/parser.py +208 -0
- tf_mcp-0.3.0/src/tf_mcp/registry.py +106 -0
- tf_mcp-0.3.0/src/tf_mcp/server.py +294 -0
tf_mcp-0.3.0/.gitignore
ADDED
tf_mcp-0.3.0/CLAUDE.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Terraform MCP Server
|
|
2
|
+
|
|
3
|
+
## Project Overview
|
|
4
|
+
Multi-cloud MCP server for discovering and generating Terraform code from module catalogs across AWS, Azure, and GCP.
|
|
5
|
+
|
|
6
|
+
## Architecture
|
|
7
|
+
- `src/tf_mcp/server.py` — FastMCP entry point with tools and resources
|
|
8
|
+
- `src/tf_mcp/registry.py` — Multi-cloud module registry, auto-discovers sibling repos
|
|
9
|
+
- `src/tf_mcp/parser.py` — Cloud-agnostic HCL parser for variables, outputs, costs
|
|
10
|
+
- `src/tf_mcp/models.py` — Pydantic models (ModuleInfo, VariableInfo, etc.)
|
|
11
|
+
- `src/tf_mcp/codegen.py` — Multi-cloud Terraform code generation
|
|
12
|
+
- `src/tf_mcp/dependencies.py` — Unified dependency/wiring lookup across clouds
|
|
13
|
+
- `src/tf_mcp/clouds/{aws,azure,gcp}.py` — Per-cloud static metadata (layers, wiring, descriptions)
|
|
14
|
+
|
|
15
|
+
## Adding a new cloud's module metadata
|
|
16
|
+
1. Add module layers, descriptions, dependencies, wiring to `src/tf_mcp/clouds/<cloud>.py`
|
|
17
|
+
2. The registry will auto-discover modules from the sibling `<cloud>-tf/modules/` directory
|
|
18
|
+
3. For clouds without metadata, the registry discovers all subdirs with a `main.tf`
|
|
19
|
+
|
|
20
|
+
## Key patterns
|
|
21
|
+
- `python-hcl2` strips comments — cost blocks parsed via regex on raw text
|
|
22
|
+
- hcl2 represents types as nested lists: `['list', 'string']` -> `list(string)`
|
|
23
|
+
- All tools accept a `cloud` parameter; `list_modules` accepts optional cloud filter
|
|
24
|
+
- Provider config (source, version, provider block) lives in per-cloud metadata
|
tf_mcp-0.3.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Michael Ujifusa
|
|
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.
|
tf_mcp-0.3.0/PKG-INFO
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: tf-mcp
|
|
3
|
+
Version: 0.3.0
|
|
4
|
+
Summary: Multi-cloud MCP server for discovering and generating Terraform code from module catalogs
|
|
5
|
+
Project-URL: Homepage, https://github.com/m-ujifusa/tf-mcp-server
|
|
6
|
+
Project-URL: Repository, https://github.com/m-ujifusa/tf-mcp-server
|
|
7
|
+
Project-URL: Issues, https://github.com/m-ujifusa/tf-mcp-server/issues
|
|
8
|
+
License-Expression: MIT
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Keywords: aws,azure,gcp,infrastructure-as-code,mcp,model-context-protocol,terraform
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: fastmcp>=2.0
|
|
19
|
+
Requires-Dist: pydantic>=2.0
|
|
20
|
+
Requires-Dist: python-hcl2>=5.0
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# Terraform Modules MCP Server
|
|
24
|
+
|
|
25
|
+
A multi-cloud MCP server that lets AI assistants discover, understand, and generate Terraform code from module catalogs across AWS, Azure, and GCP.
|
|
26
|
+
|
|
27
|
+
## What it does
|
|
28
|
+
|
|
29
|
+
- **Discover modules** — list modules across all clouds with descriptions, dependencies, and costs
|
|
30
|
+
- **Understand wiring** — see how modules connect (e.g., VPC outputs feed into EKS inputs)
|
|
31
|
+
- **Estimate costs** — get per-module cost breakdowns by tier (dev/staging/prod)
|
|
32
|
+
- **Generate code** — produce ready-to-use `.tf` files for single modules or full stacks
|
|
33
|
+
|
|
34
|
+
## Quick start
|
|
35
|
+
|
|
36
|
+
### Install via Claude Code
|
|
37
|
+
|
|
38
|
+
Add to your `~/.mcp.json` (global) or `.claude/mcp.json` (per-project):
|
|
39
|
+
|
|
40
|
+
```json
|
|
41
|
+
{
|
|
42
|
+
"mcpServers": {
|
|
43
|
+
"tf-modules": {
|
|
44
|
+
"command": "uvx",
|
|
45
|
+
"args": ["tf-mcp"],
|
|
46
|
+
"env": {
|
|
47
|
+
"TF_MODULES_AWS_DIR": "/path/to/your/aws-tf/modules",
|
|
48
|
+
"TF_MODULES_AZURE_DIR": "/path/to/your/azure-tf/modules",
|
|
49
|
+
"TF_MODULES_GCP_DIR": "/path/to/your/gcp-tf/modules"
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Only include the `env` entries for clouds you have modules for.
|
|
57
|
+
|
|
58
|
+
### Install via pip
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pip install tf-mcp
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Run standalone
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
tf-mcp
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
## Prerequisites
|
|
71
|
+
|
|
72
|
+
- Python >= 3.11
|
|
73
|
+
- One or more directories containing Terraform modules
|
|
74
|
+
|
|
75
|
+
## Module directory layout
|
|
76
|
+
|
|
77
|
+
Point the server at directories containing Terraform modules. Each module should be a subdirectory with at least a `main.tf`:
|
|
78
|
+
|
|
79
|
+
```
|
|
80
|
+
your-modules-dir/
|
|
81
|
+
vpc/
|
|
82
|
+
main.tf
|
|
83
|
+
variables.tf
|
|
84
|
+
outputs.tf
|
|
85
|
+
eks-cluster/
|
|
86
|
+
main.tf
|
|
87
|
+
variables.tf
|
|
88
|
+
outputs.tf
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
The server auto-discovers all subdirectories containing a `main.tf`.
|
|
92
|
+
|
|
93
|
+
## Configuration
|
|
94
|
+
|
|
95
|
+
Tell the server where your modules live using environment variables:
|
|
96
|
+
|
|
97
|
+
| Variable | Description |
|
|
98
|
+
|----------|-------------|
|
|
99
|
+
| `TF_MODULES_AWS_DIR` | Path to AWS `modules/` directory |
|
|
100
|
+
| `TF_MODULES_AZURE_DIR` | Path to Azure `modules/` directory |
|
|
101
|
+
| `TF_MODULES_GCP_DIR` | Path to GCP `modules/` directory |
|
|
102
|
+
|
|
103
|
+
If no env vars are set, the server looks for sibling repos in the default layout:
|
|
104
|
+
|
|
105
|
+
```
|
|
106
|
+
parent-dir/
|
|
107
|
+
aws-tf/modules/
|
|
108
|
+
azure-tf/modules/
|
|
109
|
+
gcp-tf/modules/
|
|
110
|
+
tf-mcp-server/ # this repo
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
## Tools
|
|
114
|
+
|
|
115
|
+
| Tool | Description |
|
|
116
|
+
|------|-------------|
|
|
117
|
+
| `list_modules` | List modules with optional cloud filter |
|
|
118
|
+
| `get_module_details` | Full variable/output/cost reference for one module |
|
|
119
|
+
| `get_module_dependencies` | Dependency graph and output-to-input wiring |
|
|
120
|
+
| `estimate_costs` | Cost estimates for a set of modules by tier |
|
|
121
|
+
| `generate_module_code` | Generate `.tf` for a single module |
|
|
122
|
+
| `generate_stack_code` | Generate a complete multi-module stack with auto-wiring |
|
|
123
|
+
|
|
124
|
+
## Resources
|
|
125
|
+
|
|
126
|
+
| URI | Description |
|
|
127
|
+
|-----|-------------|
|
|
128
|
+
| `modules://catalog` | Full listing across all clouds |
|
|
129
|
+
| `modules://{cloud}/catalog` | Listing for one cloud |
|
|
130
|
+
| `modules://{cloud}/{name}/readme` | Module README.md |
|
|
131
|
+
| `modules://{cloud}/{name}/examples` | Module examples/main.tf |
|
|
132
|
+
| `modules://{cloud}/dependency-graph` | Text dependency graph |
|
|
133
|
+
| `modules://conventions` | Terraform conventions |
|
|
134
|
+
|
|
135
|
+
## Development
|
|
136
|
+
|
|
137
|
+
```bash
|
|
138
|
+
git clone https://github.com/m-ujifusa/tf-mcp-server.git
|
|
139
|
+
cd tf-mcp-server
|
|
140
|
+
uv sync
|
|
141
|
+
uv run tf-mcp
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
MIT
|
tf_mcp-0.3.0/README.md
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
# Terraform Modules MCP Server
|
|
2
|
+
|
|
3
|
+
A multi-cloud MCP server that lets AI assistants discover, understand, and generate Terraform code from module catalogs across AWS, Azure, and GCP.
|
|
4
|
+
|
|
5
|
+
## What it does
|
|
6
|
+
|
|
7
|
+
- **Discover modules** — list modules across all clouds with descriptions, dependencies, and costs
|
|
8
|
+
- **Understand wiring** — see how modules connect (e.g., VPC outputs feed into EKS inputs)
|
|
9
|
+
- **Estimate costs** — get per-module cost breakdowns by tier (dev/staging/prod)
|
|
10
|
+
- **Generate code** — produce ready-to-use `.tf` files for single modules or full stacks
|
|
11
|
+
|
|
12
|
+
## Quick start
|
|
13
|
+
|
|
14
|
+
### Install via Claude Code
|
|
15
|
+
|
|
16
|
+
Add to your `~/.mcp.json` (global) or `.claude/mcp.json` (per-project):
|
|
17
|
+
|
|
18
|
+
```json
|
|
19
|
+
{
|
|
20
|
+
"mcpServers": {
|
|
21
|
+
"tf-modules": {
|
|
22
|
+
"command": "uvx",
|
|
23
|
+
"args": ["tf-mcp"],
|
|
24
|
+
"env": {
|
|
25
|
+
"TF_MODULES_AWS_DIR": "/path/to/your/aws-tf/modules",
|
|
26
|
+
"TF_MODULES_AZURE_DIR": "/path/to/your/azure-tf/modules",
|
|
27
|
+
"TF_MODULES_GCP_DIR": "/path/to/your/gcp-tf/modules"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Only include the `env` entries for clouds you have modules for.
|
|
35
|
+
|
|
36
|
+
### Install via pip
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
pip install tf-mcp
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Run standalone
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
tf-mcp
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Prerequisites
|
|
49
|
+
|
|
50
|
+
- Python >= 3.11
|
|
51
|
+
- One or more directories containing Terraform modules
|
|
52
|
+
|
|
53
|
+
## Module directory layout
|
|
54
|
+
|
|
55
|
+
Point the server at directories containing Terraform modules. Each module should be a subdirectory with at least a `main.tf`:
|
|
56
|
+
|
|
57
|
+
```
|
|
58
|
+
your-modules-dir/
|
|
59
|
+
vpc/
|
|
60
|
+
main.tf
|
|
61
|
+
variables.tf
|
|
62
|
+
outputs.tf
|
|
63
|
+
eks-cluster/
|
|
64
|
+
main.tf
|
|
65
|
+
variables.tf
|
|
66
|
+
outputs.tf
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The server auto-discovers all subdirectories containing a `main.tf`.
|
|
70
|
+
|
|
71
|
+
## Configuration
|
|
72
|
+
|
|
73
|
+
Tell the server where your modules live using environment variables:
|
|
74
|
+
|
|
75
|
+
| Variable | Description |
|
|
76
|
+
|----------|-------------|
|
|
77
|
+
| `TF_MODULES_AWS_DIR` | Path to AWS `modules/` directory |
|
|
78
|
+
| `TF_MODULES_AZURE_DIR` | Path to Azure `modules/` directory |
|
|
79
|
+
| `TF_MODULES_GCP_DIR` | Path to GCP `modules/` directory |
|
|
80
|
+
|
|
81
|
+
If no env vars are set, the server looks for sibling repos in the default layout:
|
|
82
|
+
|
|
83
|
+
```
|
|
84
|
+
parent-dir/
|
|
85
|
+
aws-tf/modules/
|
|
86
|
+
azure-tf/modules/
|
|
87
|
+
gcp-tf/modules/
|
|
88
|
+
tf-mcp-server/ # this repo
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Tools
|
|
92
|
+
|
|
93
|
+
| Tool | Description |
|
|
94
|
+
|------|-------------|
|
|
95
|
+
| `list_modules` | List modules with optional cloud filter |
|
|
96
|
+
| `get_module_details` | Full variable/output/cost reference for one module |
|
|
97
|
+
| `get_module_dependencies` | Dependency graph and output-to-input wiring |
|
|
98
|
+
| `estimate_costs` | Cost estimates for a set of modules by tier |
|
|
99
|
+
| `generate_module_code` | Generate `.tf` for a single module |
|
|
100
|
+
| `generate_stack_code` | Generate a complete multi-module stack with auto-wiring |
|
|
101
|
+
|
|
102
|
+
## Resources
|
|
103
|
+
|
|
104
|
+
| URI | Description |
|
|
105
|
+
|-----|-------------|
|
|
106
|
+
| `modules://catalog` | Full listing across all clouds |
|
|
107
|
+
| `modules://{cloud}/catalog` | Listing for one cloud |
|
|
108
|
+
| `modules://{cloud}/{name}/readme` | Module README.md |
|
|
109
|
+
| `modules://{cloud}/{name}/examples` | Module examples/main.tf |
|
|
110
|
+
| `modules://{cloud}/dependency-graph` | Text dependency graph |
|
|
111
|
+
| `modules://conventions` | Terraform conventions |
|
|
112
|
+
|
|
113
|
+
## Development
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
git clone https://github.com/m-ujifusa/tf-mcp-server.git
|
|
117
|
+
cd tf-mcp-server
|
|
118
|
+
uv sync
|
|
119
|
+
uv run tf-mcp
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## License
|
|
123
|
+
|
|
124
|
+
MIT
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "tf-mcp"
|
|
3
|
+
version = "0.3.0"
|
|
4
|
+
description = "Multi-cloud MCP server for discovering and generating Terraform code from module catalogs"
|
|
5
|
+
requires-python = ">=3.11"
|
|
6
|
+
readme = "README.md"
|
|
7
|
+
license = "MIT"
|
|
8
|
+
keywords = ["terraform", "mcp", "model-context-protocol", "infrastructure-as-code", "aws", "azure", "gcp"]
|
|
9
|
+
classifiers = [
|
|
10
|
+
"Development Status :: 4 - Beta",
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"Programming Language :: Python :: 3.11",
|
|
13
|
+
"Programming Language :: Python :: 3.12",
|
|
14
|
+
"Programming Language :: Python :: 3.13",
|
|
15
|
+
"License :: OSI Approved :: MIT License",
|
|
16
|
+
]
|
|
17
|
+
dependencies = [
|
|
18
|
+
"fastmcp>=2.0",
|
|
19
|
+
"python-hcl2>=5.0",
|
|
20
|
+
"pydantic>=2.0",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.scripts]
|
|
24
|
+
tf-mcp = "tf_mcp.server:main"
|
|
25
|
+
|
|
26
|
+
[project.urls]
|
|
27
|
+
Homepage = "https://github.com/m-ujifusa/tf-mcp-server"
|
|
28
|
+
Repository = "https://github.com/m-ujifusa/tf-mcp-server"
|
|
29
|
+
Issues = "https://github.com/m-ujifusa/tf-mcp-server/issues"
|
|
30
|
+
|
|
31
|
+
[build-system]
|
|
32
|
+
requires = ["hatchling"]
|
|
33
|
+
build-backend = "hatchling.build"
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Per-cloud module metadata: layers, dependencies, wiring, descriptions."""
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
"""AWS module metadata: layers, dependencies, wiring, descriptions.
|
|
2
|
+
|
|
3
|
+
Moved from the original aws_tf_mcp.dependencies module.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
# Layer assignments for topological ordering
|
|
9
|
+
MODULE_LAYERS: dict[str, int] = {
|
|
10
|
+
"vpc": 1,
|
|
11
|
+
"ecr-repository": 1,
|
|
12
|
+
"ecs-cluster": 2,
|
|
13
|
+
"eks-cluster": 2,
|
|
14
|
+
"ec2-asg": 3,
|
|
15
|
+
"ecs-service": 3,
|
|
16
|
+
"eks-node-group": 3,
|
|
17
|
+
"eks-fargate-profile": 3,
|
|
18
|
+
"lambda-function": 3,
|
|
19
|
+
"eks-irsa": 4,
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
MODULE_DESCRIPTIONS: dict[str, str] = {
|
|
23
|
+
"vpc": "Multi-AZ VPC with public/private/database subnets, NAT Gateways, flow logs",
|
|
24
|
+
"eks-cluster": "EKS control plane with OIDC, secrets encryption, logging, addons",
|
|
25
|
+
"eks-node-group": "Managed EKS node group with launch template, scaling, taints/labels",
|
|
26
|
+
"eks-fargate-profile": "EKS Fargate profile for serverless Kubernetes pods",
|
|
27
|
+
"eks-irsa": "IAM Roles for Service Accounts (IRSA) or Pod Identity",
|
|
28
|
+
"ecs-cluster": "ECS cluster with Fargate/EC2 capacity providers, Container Insights",
|
|
29
|
+
"ecs-service": "ECS service + task definition + IAM roles + auto-scaling",
|
|
30
|
+
"ecr-repository": "ECR repo with lifecycle policies, scanning, cross-account access",
|
|
31
|
+
"ec2-asg": "EC2 Auto Scaling Group with launch template, mixed instances, ALB integration",
|
|
32
|
+
"lambda-function": "Lambda function with IAM role, VPC config, layers, log group",
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
DIRECT_DEPENDENCIES: dict[str, list[str]] = {
|
|
36
|
+
"vpc": [],
|
|
37
|
+
"ecr-repository": [],
|
|
38
|
+
"ecs-cluster": [],
|
|
39
|
+
"eks-cluster": ["vpc"],
|
|
40
|
+
"eks-node-group": ["eks-cluster", "vpc"],
|
|
41
|
+
"eks-fargate-profile": ["eks-cluster", "vpc"],
|
|
42
|
+
"eks-irsa": ["eks-cluster"],
|
|
43
|
+
"ecs-service": ["ecs-cluster", "vpc"],
|
|
44
|
+
"ec2-asg": ["vpc"],
|
|
45
|
+
"lambda-function": ["vpc"],
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
WIRING_MAP: dict[tuple[str, str], dict[str, str]] = {
|
|
49
|
+
("vpc", "eks-cluster"): {
|
|
50
|
+
"vpc_id": "vpc_id",
|
|
51
|
+
"private_subnet_ids": "subnet_ids",
|
|
52
|
+
},
|
|
53
|
+
("vpc", "eks-node-group"): {
|
|
54
|
+
"private_subnet_ids": "subnet_ids",
|
|
55
|
+
},
|
|
56
|
+
("vpc", "eks-fargate-profile"): {
|
|
57
|
+
"private_subnet_ids": "subnet_ids",
|
|
58
|
+
},
|
|
59
|
+
("vpc", "ec2-asg"): {
|
|
60
|
+
"vpc_id": "vpc_id",
|
|
61
|
+
"private_subnet_ids": "subnet_ids",
|
|
62
|
+
},
|
|
63
|
+
("vpc", "ecs-service"): {
|
|
64
|
+
"vpc_id": "vpc_id",
|
|
65
|
+
"private_subnet_ids": "subnet_ids",
|
|
66
|
+
},
|
|
67
|
+
("vpc", "lambda-function"): {
|
|
68
|
+
"private_subnet_ids": "vpc_config.subnet_ids",
|
|
69
|
+
},
|
|
70
|
+
("eks-cluster", "eks-node-group"): {
|
|
71
|
+
"cluster_name": "cluster_name",
|
|
72
|
+
},
|
|
73
|
+
("eks-cluster", "eks-fargate-profile"): {
|
|
74
|
+
"cluster_name": "cluster_name",
|
|
75
|
+
},
|
|
76
|
+
("eks-cluster", "eks-irsa"): {
|
|
77
|
+
"oidc_provider_arn": "oidc_provider_arn",
|
|
78
|
+
"oidc_provider_url": "oidc_provider_url",
|
|
79
|
+
"cluster_name": "cluster_name",
|
|
80
|
+
},
|
|
81
|
+
("ecs-cluster", "ecs-service"): {
|
|
82
|
+
"cluster_arn": "cluster_arn",
|
|
83
|
+
"cluster_name": "cluster_name",
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
PROVIDER_CONFIG = {
|
|
88
|
+
"source": "hashicorp/aws",
|
|
89
|
+
"version_constraint": "~> 5.0",
|
|
90
|
+
"provider_name": "aws",
|
|
91
|
+
"provider_block": 'provider "aws" {\n region = var.region\n}',
|
|
92
|
+
"region_variable": "region",
|
|
93
|
+
"region_default": "us-east-1",
|
|
94
|
+
"tags_variable": "tags",
|
|
95
|
+
"tags_type": "map(string)",
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
IDENTITY_DEFAULTS: dict[str, dict[str, str]] = {
|
|
99
|
+
"vpc": {
|
|
100
|
+
"cidr_block": '"10.0.0.0/16"',
|
|
101
|
+
"azs": "local.azs",
|
|
102
|
+
},
|
|
103
|
+
"eks-cluster": {
|
|
104
|
+
"cluster_version": '"1.31"',
|
|
105
|
+
},
|
|
106
|
+
"eks-node-group": {
|
|
107
|
+
"node_group_name": '"general"',
|
|
108
|
+
"cluster_version": '"1.31"',
|
|
109
|
+
},
|
|
110
|
+
"eks-fargate-profile": {
|
|
111
|
+
"profile_name": '"default"',
|
|
112
|
+
},
|
|
113
|
+
"eks-irsa": {
|
|
114
|
+
"role_name_suffix": '"app"',
|
|
115
|
+
"service_account_namespace": '"default"',
|
|
116
|
+
"service_account_name": '"app"',
|
|
117
|
+
},
|
|
118
|
+
"ecs-cluster": {},
|
|
119
|
+
"ecs-service": {
|
|
120
|
+
"container_image": '"nginx:alpine"',
|
|
121
|
+
},
|
|
122
|
+
"ecr-repository": {},
|
|
123
|
+
"ec2-asg": {
|
|
124
|
+
"asg_name": '"web"',
|
|
125
|
+
},
|
|
126
|
+
"lambda-function": {
|
|
127
|
+
"function_name": '"worker"',
|
|
128
|
+
"runtime": '"python3.12"',
|
|
129
|
+
"handler": '"main.handler"',
|
|
130
|
+
},
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
KEY_OUTPUTS: dict[str, list[str]] = {
|
|
134
|
+
"vpc": ["vpc_id"],
|
|
135
|
+
"eks-cluster": ["cluster_name", "cluster_endpoint"],
|
|
136
|
+
"eks-node-group": ["node_group_name"],
|
|
137
|
+
"eks-fargate-profile": ["fargate_profile_name"],
|
|
138
|
+
"eks-irsa": ["role_arn"],
|
|
139
|
+
"ecs-cluster": ["cluster_name"],
|
|
140
|
+
"ecs-service": ["service_name"],
|
|
141
|
+
"ecr-repository": ["repository_url"],
|
|
142
|
+
"ec2-asg": ["asg_name"],
|
|
143
|
+
"lambda-function": ["function_arn"],
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
SHORT_NAMES: dict[str, str] = {
|
|
147
|
+
"vpc": "vpc",
|
|
148
|
+
"eks-cluster": "eks",
|
|
149
|
+
"eks-node-group": "node_group",
|
|
150
|
+
"eks-fargate-profile": "fargate",
|
|
151
|
+
"eks-irsa": "irsa",
|
|
152
|
+
"ecs-cluster": "ecs",
|
|
153
|
+
"ecs-service": "service",
|
|
154
|
+
"ecr-repository": "ecr",
|
|
155
|
+
"ec2-asg": "asg",
|
|
156
|
+
"lambda-function": "lambda",
|
|
157
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"""Azure module metadata: layers, dependencies, wiring, descriptions."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
# Layer assignments for topological ordering
|
|
6
|
+
MODULE_LAYERS: dict[str, int] = {
|
|
7
|
+
"vnet": 1,
|
|
8
|
+
"container-registry": 1,
|
|
9
|
+
"aks-cluster": 2,
|
|
10
|
+
"container-app-environment": 2,
|
|
11
|
+
"aks-node-pool": 3,
|
|
12
|
+
"aks-workload-identity": 3,
|
|
13
|
+
"container-app": 3,
|
|
14
|
+
"function-app": 3,
|
|
15
|
+
"vm-scale-set": 3,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
MODULE_DESCRIPTIONS: dict[str, str] = {
|
|
19
|
+
"vnet": "VNet with public/private/database subnets, NSGs, NAT Gateway, flow logs",
|
|
20
|
+
"aks-cluster": "AKS control plane with system node pool, RBAC, monitoring, workload identity",
|
|
21
|
+
"aks-node-pool": "AKS user node pool with autoscaling, spot instances, taints/labels",
|
|
22
|
+
"aks-workload-identity": "Managed identity with federated credential for Kubernetes workload identity",
|
|
23
|
+
"container-registry": "ACR with SKU tiers, geo-replication, retention, network rules, encryption",
|
|
24
|
+
"container-app-environment": "Container Apps Environment with VNet integration, Log Analytics",
|
|
25
|
+
"container-app": "Container App with containers, ingress, scaling rules, registries, secrets",
|
|
26
|
+
"function-app": "Function App with App Service Plan, Storage, Application Insights, VNet integration",
|
|
27
|
+
"vm-scale-set": "Linux VMSS with autoscaling, spot VMs, availability zones, managed identity",
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
DIRECT_DEPENDENCIES: dict[str, list[str]] = {
|
|
31
|
+
"vnet": [],
|
|
32
|
+
"container-registry": [],
|
|
33
|
+
"aks-cluster": ["vnet"],
|
|
34
|
+
"container-app-environment": [],
|
|
35
|
+
"aks-node-pool": ["aks-cluster", "vnet"],
|
|
36
|
+
"aks-workload-identity": ["aks-cluster"],
|
|
37
|
+
"container-app": ["container-app-environment"],
|
|
38
|
+
"function-app": ["vnet"],
|
|
39
|
+
"vm-scale-set": ["vnet"],
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
# Wiring: (source_module, target_module) -> {source_output: target_input}
|
|
43
|
+
# Only includes direct output-to-input matches (same type).
|
|
44
|
+
# vnet -> subnet_id wirings are omitted because private_subnet_ids is a list
|
|
45
|
+
# and subnet_id expects a string — users must index: module.vnet.private_subnet_ids[0]
|
|
46
|
+
WIRING_MAP: dict[tuple[str, str], dict[str, str]] = {
|
|
47
|
+
("aks-cluster", "aks-node-pool"): {
|
|
48
|
+
"cluster_id": "cluster_id",
|
|
49
|
+
},
|
|
50
|
+
("aks-cluster", "aks-workload-identity"): {
|
|
51
|
+
"oidc_issuer_url": "oidc_issuer_url",
|
|
52
|
+
},
|
|
53
|
+
("container-app-environment", "container-app"): {
|
|
54
|
+
"environment_id": "container_app_environment_id",
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
PROVIDER_CONFIG = {
|
|
59
|
+
"source": "hashicorp/azurerm",
|
|
60
|
+
"version_constraint": "~> 4.0",
|
|
61
|
+
"provider_name": "azurerm",
|
|
62
|
+
"provider_block": 'provider "azurerm" {\n features {}\n}',
|
|
63
|
+
"region_variable": "location",
|
|
64
|
+
"region_default": "eastus",
|
|
65
|
+
"tags_variable": "tags",
|
|
66
|
+
"tags_type": "map(string)",
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
IDENTITY_DEFAULTS: dict[str, dict[str, str]] = {
|
|
70
|
+
"vnet": {
|
|
71
|
+
"address_space": '"10.0.0.0/16"',
|
|
72
|
+
},
|
|
73
|
+
"aks-cluster": {
|
|
74
|
+
"kubernetes_version": '"1.31"',
|
|
75
|
+
},
|
|
76
|
+
"aks-node-pool": {
|
|
77
|
+
"node_pool_name": '"general"',
|
|
78
|
+
},
|
|
79
|
+
"aks-workload-identity": {
|
|
80
|
+
"identity_name": '"app"',
|
|
81
|
+
"namespace": '"default"',
|
|
82
|
+
"service_account_name": '"app"',
|
|
83
|
+
},
|
|
84
|
+
"container-registry": {},
|
|
85
|
+
"container-app-environment": {},
|
|
86
|
+
"container-app": {
|
|
87
|
+
"container_app_name": '"app"',
|
|
88
|
+
},
|
|
89
|
+
"function-app": {
|
|
90
|
+
"function_name": '"worker"',
|
|
91
|
+
"runtime_stack": '"python"',
|
|
92
|
+
"runtime_version": '"3.11"',
|
|
93
|
+
},
|
|
94
|
+
"vm-scale-set": {
|
|
95
|
+
"vmss_name": '"web"',
|
|
96
|
+
},
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
KEY_OUTPUTS: dict[str, list[str]] = {
|
|
100
|
+
"vnet": ["vnet_id"],
|
|
101
|
+
"aks-cluster": ["cluster_name", "cluster_id"],
|
|
102
|
+
"aks-node-pool": ["node_pool_name"],
|
|
103
|
+
"aks-workload-identity": ["identity_client_id"],
|
|
104
|
+
"container-registry": ["login_server"],
|
|
105
|
+
"container-app-environment": ["environment_id"],
|
|
106
|
+
"container-app": ["container_app_name", "fqdn"],
|
|
107
|
+
"function-app": ["function_app_name", "default_hostname"],
|
|
108
|
+
"vm-scale-set": ["vmss_id"],
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
SHORT_NAMES: dict[str, str] = {
|
|
112
|
+
"vnet": "vnet",
|
|
113
|
+
"aks-cluster": "aks",
|
|
114
|
+
"aks-node-pool": "node_pool",
|
|
115
|
+
"aks-workload-identity": "workload_id",
|
|
116
|
+
"container-registry": "acr",
|
|
117
|
+
"container-app-environment": "cae",
|
|
118
|
+
"container-app": "app",
|
|
119
|
+
"function-app": "func",
|
|
120
|
+
"vm-scale-set": "vmss",
|
|
121
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"""GCP module metadata: layers, dependencies, wiring, descriptions.
|
|
2
|
+
|
|
3
|
+
Stub — populated as modules are added to gcp-tf.
|
|
4
|
+
"""
|
|
5
|
+
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
MODULE_LAYERS: dict[str, int] = {}
|
|
9
|
+
|
|
10
|
+
MODULE_DESCRIPTIONS: dict[str, str] = {}
|
|
11
|
+
|
|
12
|
+
DIRECT_DEPENDENCIES: dict[str, list[str]] = {}
|
|
13
|
+
|
|
14
|
+
WIRING_MAP: dict[tuple[str, str], dict[str, str]] = {}
|
|
15
|
+
|
|
16
|
+
PROVIDER_CONFIG = {
|
|
17
|
+
"source": "hashicorp/google",
|
|
18
|
+
"version_constraint": "~> 5.0",
|
|
19
|
+
"provider_name": "google",
|
|
20
|
+
"provider_block": 'provider "google" {\n project = var.project_id\n region = var.region\n}',
|
|
21
|
+
"region_variable": "region",
|
|
22
|
+
"region_default": "us-central1",
|
|
23
|
+
"tags_variable": "labels",
|
|
24
|
+
"tags_type": "map(string)",
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
IDENTITY_DEFAULTS: dict[str, dict[str, str]] = {}
|
|
28
|
+
|
|
29
|
+
KEY_OUTPUTS: dict[str, list[str]] = {}
|
|
30
|
+
|
|
31
|
+
SHORT_NAMES: dict[str, str] = {}
|