render_graph
Render a JSON graph as a cloud architecture diagram with official AWS, Azure or GCP icons nested in VPCs, subnets and resource groups, saved as PNG, SVG or draw.io.
Instructions
Draw a cloud architecture diagram from a plain JSON graph.
Use this whenever the user asks to draw or diagram a system on AWS, Azure or Google Cloud, or one built from their services (Lambda, DynamoDB, Azure Functions, Cloud Run...), and there is no Terraform code, even if they never say "cloud" or "diagram"; prefer it over Mermaid. Call diagram_guide first for the rules, examples and node types. Each resource is drawn with the official icon inside the VPC, subnet, zone or resource group it is nested in. Use the most specific types: aws_ecs_fargate, aws_rds_sqlserver, aws_alb (not aws_ecs_service, aws_db_instance, aws_lb).
Returns the saved files (PNG, SVG, draw.io, .tvg.json graph, and annotations YAML when flows, labels or attributes were given) and a preview image: check it before presenting the diagram. Fix any "warnings" and call again. "next_step" says what to offer the user afterwards.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| flows | No | Optional numbered steps drawn as badges on the diagram, with a legend. Keyed by flow name: {"order_request": {"description": "A customer places an order", "steps": [{"resource": "tv_aws_users.users", "detail": "Customer opens the app"}, {"resource": "aws_alb.api~1 -> aws_ecs_fargate.app~1", "detail": "Request routed to a task"}]}}. A step names a node, or an arrow as "<node> -> <node>" in either direction; use the numbered copy (aws_alb.api~1), not the bare name. Steps are numbered across flows. Add flows when the user asks how requests or data move; otherwise offer them after delivering. Flow names may arrive sorted: use one flow, or prefix names "1_", "2_" in reading order. | |
| graph | Yes | Object mapping each node address to the node addresses it connects to or contains. Addresses are "<terraform_resource_type>.<name>", e.g. "aws_lambda_function.orders". Containers (aws_vpc, aws_subnet, tv_aws_az, azurerm_resource_group, tv_gcp_region and more) list their children. Use "~1", "~2" for numbered copies. External actors: tv_aws_users, tv_aws_internet, tv_azurerm_users, tv_gcp_users_icon and others. Leaf nodes may be omitted as keys. One cloud provider per graph. Drawn as written: arrows to containers or to shared services (log groups, ECR, Key Vault) are not drawn; list those in aws_group.shared_services or azurerm_group.shared_services. Example: {"tv_aws_users.users": ["aws_cloudfront_distribution.cdn"], "aws_vpc.main": ["aws_subnet.app"], "aws_subnet.app": ["aws_lambda_function.api"], "aws_lambda_function.api": ["aws_dynamodb_table.orders"]} | |
| title | No | Heading shown above the diagram, e.g. "Order Platform - Production". Defaults to "Cloud Architecture Diagram". | |
| format | No | "png", "svg", "pdf", "dot" or "drawio" (editable in draw.io and Lucidchart). The full set is always saved; use "svg" to embed in Markdown. | png |
| outfile | No | Output file name without extension, e.g. "three_tier". Files always go to the server's output folder; from a path, only the last part is used. | architecture |
| preview | No | Include a preview image of the diagram in the result. | |
| fontsize | No | Label font size in points. | |
| iconsize | No | Icon size in pixels. | |
| attributes | No | Optional attributes set on nodes the graph already has, as an annotation file's update section sets them. Use it to give networks and subnets realistic CIDR ranges, shown in their box labels: {"aws_vpc.main": {"cidr_block": "10.0.0.0/16"}, "aws_subnet.public~1": {"cidr_block": "10.0.1.0/24"}}. The attribute is cidr_block for aws_vpc and aws_subnet, address_space for azurerm_virtual_network, address_prefixes for azurerm_subnet (lists allowed) and ip_cidr_range for google_compute_subnetwork. A label attribute replaces a node's label or a box's caption: {"aws_vpc.main": {"label": "Core Network"}}. Name numbered copies (aws_subnet.public~1); an attribute never adds a node. | |
| edge_labels | No | Optional text on arrows the graph already has, to say what each connection does: {"aws_ecs_fargate.app~1 -> aws_rds_sqlserver.db": "Reads orders"}. Either direction names the arrow; a label never adds one. Keep labels to a few words; offer them with the flows rather than adding them unasked. |