terraform-diagrams
Generates architecture diagrams from Terraform code. Use when user has .tf files or asks to visualize Terraform infrastructure.
от eraserlabs★ 47 звёзд на GitHub
Установить terraform-diagrams в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Об этом скилле
Terraform Diagram Generator
Generates architecture diagrams directly from Terraform .tf files. Specializes in parsing Terraform code and visualizing infrastructure resources, modules, and their relationships.
When to Use
Activate this skill when:
- User has Terraform files (
.tf,.tfvars) and wants to visualize the infrastructure - User asks to "diagram my Terraform" or "visualize this infrastructure"
- User mentions Terraform, HCL, or infrastructure-as-code
- User wants to see the architecture of their Terraform-managed resources
How It Works
This skill generates Terraform-specific diagrams by parsing Terraform code and calling the Eraser API directly:
- Parse Terraform Files: Identify resources, modules, data sources, and variables
- Extract Relationships: Map dependencies, resource connections, and module hierarchies
- Generate Eraser DSL: Create Eraser DSL code from Terraform resources
- Call Eraser API: Use
/api/render/elementswithdiagramType: "cloud-architecture-diagram"
Instructions
When the user provides Terraform code:
Parse the Terraform
- Identify all
resourceblocks (AWS, Azure, GCP, etc.) - Extract
moduleblocks and their configurations - Note
datasources and their dependencies - Identify
variableandoutputdefinitions
- Identify all
Map Relationships
- Track resource dependencies (e.g.,
subnet_id = aws_subnet.public.id) - Group resources by provider (AWS, Azure, GCP)
- Identify VPCs/VNets as containers for other resources
- Note security groups, IAM roles, and networking rules
- Track resource dependencies (e.g.,
Generate Eraser DSL Convert Terraform resources to Eraser DSL:
- CRITICAL: Label Formatting Rules
- Labels MUST be on a single line - NEVER use newlines inside label attributes
- Keep labels simple and readable - prefer separate labels over concatenating too much metadata
- Format DSL with proper line breaks (one node/group per line, but labels stay on single lines)
- If including metadata like CIDR blocks or instance types, include them in the same quoted label string:
[label: "VPC 10.0.0.0/16"]
Example:
main-vpc [label: "VPC 10.0.0.0/16"] { public-subnet [label: "Public Subnet 10.0.1.0/24"] { web-server [icon: aws-ec2, label: "Web Server t3.micro"] load-balancer [icon: aws-elb] } private-subnet [label: "Private Subnet"] { database [icon: aws-rds] } } load-balancer -> web-server web-server -> database- CRITICAL: Label Formatting Rules
Make the HTTP Request
IMPORTANT: You MUST execute this curl command after generating the DSL. Never stop after generating DSL without making the API call.
CRITICAL: In the
X-Skill-Sourceheader below, you MUST replace the value with your AI agent name:- If you are Claude (Anthropic), use:
claude - If you are running in Cursor, use:
cursor - If you are ChatGPT (OpenAI), use:
chatgpt - If you are Gemini (Google), use:
gemini - Otherwise, use your model/agent name in lowercase
curl -X POST https://app.eraser.io/api/render/elements \ -H "Content-Type: application/json" \ -H "X-Skill-Source: eraser-skill" \ -H "Authorization: Bearer ${ERASER_API_KEY}" \ -d '{ "elements": [{ "type": "diagram", "id": "diagram-1", "code": "<your generated DSL>", "diagramType": "cloud-architecture-diagram" }], "scale": 2, "theme": "${ERASER_THEME:-dark}", "background": true }'- If you are Claude (Anthropic), use:
Track Sources During Analysis
As you analyze Terraform files and resources to generate the diagram, track:
- Internal files: Record each Terraform file path you read and what resources were extracted (e.g.,
infra/main.tf- VPC and subnet definitions,infra/rds.tf- Database configuration) - External references: Note any documentation, examples, or URLs consulted (e.g., Terraform AWS provider documentation, AWS architecture best practices)
- Annotations: For each source, note what it contributed to the diagram
- Internal files: Record each Terraform file path you read and what resources were extracted (e.g.,
Handle the Response
CRITICAL: Minimal Output Format
Your response MUST always include these elements with clear headers:
Diagram Preview: Display with a header
## Diagram Use the ACTUAL
imageUrlfrom the API response.Editor Link: Display with a header
## Open in Eraser [Edit this diagram in the Eraser editor]({createEraserFileUrl})Use the ACTUAL URL from the API response.
Sources section: Brief list of files/resources analyzed (if applicable)
## Sources - `path/to/file` - What was extractedDiagram Code section: The Eraser DSL in a code block with
eraserlanguage tag## Diagram Code ```eraser {DSL code here}**Learn Mor
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
- 01
Read - 02
Write - 03
Bash(curl:*)
FAQ
Что делает скилл terraform-diagrams?
Generates architecture diagrams from Terraform code. Use when user has .tf files or asks to visualize Terraform infrastructure.
Как установить скилл terraform-diagrams?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл terraform-diagrams запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
AnthropicGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
claude-api
AnthropicReference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
algorithmic-art
AnthropicCreating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
mcp-integration
AnthropicThis skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…