generate_architecture_graph
Extract cloud architecture from Terraform code as a structured graph, resolving variables, grouping resources by network, and inferring connections for reasoning.
Instructions
Extract the cloud architecture of Terraform code as structured data.
Runs Terraform, resolves variables, expands count/for_each, groups resources into their VPCs, subnets and availability zones, and infers the connections between them. Use it to reason about an architecture; the diagram tools render this same graph. A tfdata.json source skips Terraform and returns in seconds.
Returns {"graphdict", "node_count", "edge_count", "provider"}, where graphdict maps each Terraform resource address to the addresses it connects to or contains; with services_only, {"services", "count", "provider"}.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| source | Yes | Terraform directory, Git URL, or tfdata.json replay file. Add //folder to a Git URL for a folder inside the repository, e.g. "https://github.com/org/repo//examples". A repository whose root is a reusable module plans no resources: draw a folder that uses it instead (examples/, an environment). | |
| upgrade | No | Run `terraform init -upgrade` to refresh modules. | |
| varfile | No | Paths to .tfvars files; different var files can produce different architectures from the same code. | |
| annotate | No | Path to a terravision.yml annotation file. | |
| planfile | No | Path to an existing plan JSON (terraform show -json). With graphfile, Terraform is never run and no cloud credentials are needed. | |
| graphfile | No | Path to an existing `terraform graph` DOT file. | |
| workspace | No | Terraform workspace to select. | default |
| simplified | No | Drop networking containers (VPCs, subnets, security groups) and show only the services. | |
| services_only | No | Return just the deduplicated list of cloud service types instead of the full graph. Much smaller; use this first when you only need to know what a stack is built from. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |