Skip to content
Back to search

terravision

SkillGitHubIncomplete

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today

Check it deeper on your machine

It has changed since its scan on 11 Nov 2026.

As a Claude Code plugin, install it and then ask Claude Code:

/plugin marketplace add keithmackay/mackayi/plugin install scanskillsafety@mackayiDo a deep scan of https://github.com/patrickchugh/terravision with scanskillsafety

Or from a terminal, clone it and run it:

git clone https://github.com/keithmackay/scanskillsafety-skill ~/.claude/skills/scanskillsafetynode ~/.claude/skills/scanskillsafety/cli.cjs --deep 'https://github.com/patrickchugh/terravision'

It checks the exact commit: every file, its packages against OSV (api.osv.dev), how it compares with this page's scan (findsafeskills.com receives the repository's address), and, if you agree, Claude reading every file with your own Claude subscription. It never runs the code.

Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/patrickchugh--terravision/badge.svg)](/listings/patrickchugh--terravision)

HTML

<a href="/listings/patrickchugh--terravision"><img src="/api/listings/patrickchugh--terravision/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

System Requirements

- **Python 3.10+** - **Terraform 1.x** - **Git** - **Graphviz** - **Ollama** (Optional - only required if using `--aibackend ollama`)

1. Install External Dependencies

Required Dependencies

1. **Graphviz** - https://graphviz.org/download/

   # macOS
   brew install graphviz

   # Ubuntu/Debian
   sudo apt-get install graphviz

   # Windows
   # Download from https://graphviz.org/download/

2. **Git** - https://git-scm.com/downloads

   # Most systems have git pre-installed
   git --version

3. **Terraform** - https://developer.hashicorp.com/terraform/downloads

   # Verify installation
   terraform version
   # Must be v1.0.0 or higher

2. Install TerraVision

Method 1: Quick Install in MacOS/Linux (For Casual Users - will install packages globally)

# Clone the repository
git clone https://github.com/patrickchugh/terravision.git
cd terravision

# Install Python dependencies
pip install -r requirements.txt

# Make script executable in Linux
chmod +x terravision.py

# Create symbolic link without extension (Unix/Linux/macOS)
ln -s $(pwd)/terravision.py $(pwd)/terravision

# Add to PATH
export PATH=$PATH:$(pwd)

**For Windows:**

# Clone the repository
git clone https://github.com/patrickchugh/terravision.git
cd terravision

# Install Python dependencies
pip install -r requirements.txt

# Create batch file wrapper
echo @python "%~dp0terravision.py" %* > terravision.bat

# Add current directory to PATH or copy terravision.bat to a directory in PATH
copy terravision.bat C:\Windows\System32\

Method 2: Poetry Install (Recommended for Developers and Power Users)

# MacOS or Linux users - Install Poetry if not already installed
curl -sSL https://install.python-poetry.org | python3 -

# For Windows Users
(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -

# Clone and install with Poetry
git clone https://github.com/patrickchugh/terravision.git
cd terravision
poetry install

# Activate virtual environment
source $(poetry env info --path)/bin/activate

# Create symbolic link without extension
ln -s $(pwd)/terravision.py $(pwd)/terravision

# Add current terravision directory to PATH
export PATH=$PATH:$(pwd)

Basic Usage

Generate Architecture Diagram

# Basic usage - analyze current directory
terravision draw

# Specify source directory
terravision draw --source ~/src/my-terraform-code

# Use specific Terraform workspace
terravision draw --source ~/src/my-terraform-code --workspace production

# Use variable files
terravision draw --source ~/src/my-terraform-code --varfile prod.tfvars

# Generate different formats
terravision draw --source ~/src/my-terraform-code --format svg
terravision draw --source ~/src/my-terraform-code --format pdf

# Show diagram after generation
terravision draw --source ~/src/my-terraform-code --show

# Use AI backend for diagram refinement (default: bedrock)
terravision draw --source ~/src/my-terraform-code --aibackend bedrock
terravision draw --source ~/src/my-terraform-code --aibackend ollama

Remote Git Repository Support

# Analyze Git repository
terravision draw --source https://github.com/your-repo/terraform-examples.git

# Analyze specific subfolder in Git repo
terravision draw --source https://github.com/your-repo/terraform-examples.git//aws/vpc

Export Graph Data

# Export resource relationships as JSON
terravision graphdata --source ~/src/my-terraform-code

# Show only unique services used
terravision graphdata --source ~/src/my-terraform-code --show_services

# Export to custom filename
terravision graphdata --source ~/src/my-terraform-code --outfile my-resources.json

Advanced Features

Use with annotations

# Add your own custom annotations such as labels, resources or new connections

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

.claude-plugin/marketplace.json · Manifest · 32 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. {
  2. "name": "terravision",
  3. "owner": {
  4. "name": "Patrick Chugh",
  5. "url": "https://github.com/patrickchugh"
  6. },
  7. "metadata": {
  8. "description": "Cloud architecture diagrams with official AWS, Azure and GCP icons",
  9. "version": "1.10.0"
  10. },
  11. "plugins": [
  12. {
  13. "name": "terravision-cloud-diagrams",
  14. "source": "./",
  15. "description": "Draw professional cloud architecture diagrams (AWS, Azure, GCP) from a one-sentence description of your idea, a JSON graph or Terraform code using TerraVision. Replaces Mermaid for any cloud architecture picture.",
  16. "version": "1.10.0",
  17. "author": { "name": "Patrick Chugh" },
  18. "homepage": "https://github.com/patrickchugh/terravision",
  19. "repository": "https://github.com/patrickchugh/terravision",
  20. "license": "AGPL-3.0-only",
  21. "keywords": ["aws", "azure", "gcp", "architecture", "diagram", "terraform", "graphviz"],
  22. "category": "development",
  23. "skills": ["./skills/terravision-cloud-diagrams"],
  24. "mcpServers": {
  25. "terravision": {
  26. "command": "uvx",
  27. "args": ["--from", "terravision[mcp]==0.56.1", "terravision", "mcp", "--output-dir", "./diagrams"]
  28. }
  29. }
  30. }
  31. ]
  32. }
README.md · README · 617 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. # TerraVision
  2. TerraVision is an AI-powered CLI tool that converts Terraform code into Professional Cloud Architecture Diagrams and solves the problem of keeping the most important document in cloud projects, the architecture diagram, up to date. With high velocity releases the norm now, code is the new source of truth so machine generated architecture diagrams are more accurate than relying on the freestyle diagram drawn by the cloud architect that probably doesn't match the reality of what is actually deployed in the cloud anymore.
  3. TerraVision securely runs 100% Client Side without any dependency or access to your Cloud environment, dynamically parses your conditionally created resources and variables and generates an automatic visual of your architecture. TerraVision is designed to be a 'Docs as Code' (DaC) tool that can be included in your CI/CD pipeline to update architecture diagrams after your build/test/release pipeline phases and supplement other document generators like readthedocs.io alongside it.
  4. ## Status
  5. [![lint-and-test](https://github.com/patrickchugh/terravision/actions/workflows/lint-and-test.yml/badge.svg)](https://github.com/patrickchugh/terravision/actions/workflows/lint-and-test.yml)
  6. ## Supported Cloud Providers
  7. - ✅ **AWS** (Full support with 200+ services)
  8. - 🔄 **Google Cloud Platform** (Partial Support)
  9. - 🔄 **Microsoft Azure** (Partial Support)
  10. Turn this...
  11. ![Terraform Code](./images/code.png "Turn Terraform code")
  12. into this...
  13. <img src="./images/architecture.png" width="640" height="580">
  14. > **⚠️ Alpha Software Notice**
  15. > This software is still in alpha testing and **code is shared on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND**, either express or implied. Use at your own risk.
  16. # Benefits of terravision
  17. 1. Cost
  18. - Save Visio/Drawing software licenses - terravision is free and open source
  19. - Doesn't require any cost incurring cloud resources to be spun up, it works instantly from your local machine
  20. - Regularly updating diagrams aligning, connecting dots and laying out icons is not the best use of your architect staff costs
  21. 2. Accelerate and Automate
  22. - Use TF variable files as inputs to create multiple variant diagrams from the same TF code
  23. - Doesn't require infrastructure to exist to document it. Terravision works off your terraform plan not your remote statefile
  24. - Automate creation of architecture diagrams by running terravision as part of CI/CD pipelines
  25. - YAML based Diagrams as code allows you to Annotate generated diagrams with additional custom labels and resources e.g. unmanaged resources or external systems not captured in TF code
  26. 3. Consistency across organisation
  27. - Auto downloads your organisational / external modules to ensure the latest view of downstream Terraform modules
  28. - Consistent design of architecture diagrams using industry standard icons and AWS/GCP/Azure approved style across teams
  29. 4. Accurate Visibility
  30. - Real time state of diagram shows current infrastructure that matches exactly what is deployed in production today
  31. - Helps in third party architecture reviews, auditing, monitoring, reporting and debugging of the stack in a visual way
  32. - Custom Diagram code and output images can be put into source/version control for better maintainability and discoverability
  33. 5. Security
  34. - Don't need to give access to your AWS account, credentials or CLI to draw diagram
  35. - Doesn't create intrusive cloud resources e.g. scanning instances or metadata tables which enterprises would need to approve
  36. - All source code stays in your local environment, diagrams are generated on your machines without calling out to external APIs
  37. - Only metatdata is sent to LLM models with only minimal aggregate data saved in external files, not any sensitive code or runtime environment values
  38. # CI/CD Pipeline Integration
  39. TerraVision seamlessly integrates into your CI/CD pipeline to automatically keep architecture diagrams synchronized with your infrastructure code:
  40. ```mermaid
  41. graph TD
  42. A[Developer Commits<br/>Terraform Code] --> B[Git Push]
  43. B --> C[CI/CD Pipeline<br/>Triggered]
  44. C --> D[Build Stage]
  45. D --> E[Test Stage]
  46. E --> F[Terraform Plan]
  47. F --> G[🎨 TerraVision<br/>Generate Diagrams]
  48. G --> H[Deploy Stage]
  49. H --> I[Update Docs]
  50. I --> J[Publish to<br/>Confluence/ReadTheDocs]
  51. style G fill:#ff9900,stroke:#232f3e,stroke-width:3px,color:#fff
  52. style A fill:#4a90e2,stroke:#2e5c8a,stroke-width:2px,color:#fff
  53. style J fill:#36b37e,stroke:#1f7a54,stroke-width:2px,color:#fff
  54. ```
  55. # Installation and Usage
  56. ## System Requirements
  57. - **Python 3.10+**
  58. - **Terraform 1.x**
  59. - **Git**
  60. - **Graphviz**
  61. - **Ollama** (Optional - only required if using `--aibackend ollama`)
  62. ## 1. Install External Dependencies
  63. ### Required Dependencies
  64. 1. **Graphviz** - https://graphviz.org/download/
  65. ```bash
  66. # macOS
  67. brew install graphviz
  68. # Ubuntu/Debian
  69. sudo apt-get install graphviz
  70. # Windows
  71. # Download from https://graphviz.org/download/
  72. ```
  73. 2. **Git** - https://git-scm.com/downloads
  74. ```bash
  75. # Most systems have git pre-installed
  76. git --version
  77. ```
  78. 3. **Terraform** - https://developer.hashicorp.com/terraform/downloads
  79. ```bash
  80. # Verify installation
  81. terraform version
  82. # Must be v1.0.0 or higher
  83. ```
  84. ## 2. Install TerraVision
  85. ### Method 1: Quick Install in MacOS/Linux (For Casual Users - will install packages globally)
  86. ```bash
  87. # Clone the repository
  88. git clone https://github.com/patrickchugh/terravision.git
  89. cd terravision
  90. # Install Python dependencies
  91. pip install -r requirements.txt
  92. # Make script executable in Linux
  93. chmod +x terravision.py
  94. # Create symbolic link without extension (Unix/Linux/macOS)
  95. ln -s $(pwd)/terravision.py $(pwd)/terravision
  96. # Add to PATH
  97. export PATH=$PATH:$(pwd)
  98. ```
  99. **For Windows:**
  100. ```powershell
  101. # Clone the repository
  102. git clone https://github.com/patrickchugh/terravision.git
  103. cd terravision
  104. # Install Python dependencies
  105. pip install -r requirements.txt
  106. # Create batch file wrapper
  107. echo @python "%~dp0terravision.py" %* > terravision.bat
  108. # Add current directory to PATH or copy terravision.bat to a directory in PATH
  109. copy terravision.bat C:\Windows\System32\
  110. ```
  111. ### Method 2: Poetry Install (Recommended for Developers and Power Users)
  112. ```bash
  113. # MacOS or Linux users - Install Poetry if not already installed
  114. curl -sSL https://install.python-poetry.org | python3 -
  115. # For Windows Users
  116. (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
  117. # Clone and install with Poetry
  118. git clone https://github.com/patrickchugh/terravision.git
  119. cd terravision
  120. poetry install
  121. # Activate virtual environment
  122. source $(poetry env info --path)/bin/activate
  123. # Create symbolic link without extension
  124. ln -s $(pwd)/terravision.py $(pwd)/terravision
  125. # Add current terravision directory to PATH
  126. export PATH=$PATH:$(pwd)
  127. ```
  128. ## Basic Usage
  129. ### Generate Architecture Diagram
  130. ```bash
  131. # Basic usage - analyze current directory
  132. terravision draw
  133. # Specify source directory
  134. terravision draw --source ~/src/my-terraform-code
  135. # Use specific Terraform workspace
  136. terravision draw --source ~/src/my-terraform-code --workspace production
  137. # Use variable files
  138. terravision draw --source ~/src/my-terraform-code --varfile prod.tfvars
  139. # Generate different formats
  140. terravision draw --source ~/src/my-terraform-code --format svg
  141. terravision draw --source ~/src/my-terraform-code --format pdf
  142. # Show diagram after generation
  143. terravision draw --source ~/src/my-terraform-code --show
  144. # Use AI backend for diagram refinement (default: bedrock)
  145. terravision draw --source ~/src/my-terraform-code --aibackend bedrock
  146. terravision draw --source ~/src/my-terraform-code --aibackend ollama
  147. ```
  148. ### Remote Git Repository Support
  149. ```bash
  150. # Analyze Git repository
  151. terravision draw --source https://github.com/your-repo/terraform-examples.git
  152. # Analyze specific subfolder in Git repo
  153. terravision draw --source https://github.com/your-repo/terraform-examples.git//aws/vpc
  154. ```
  155. ### Export Graph Data
  156. ```bash
  157. # Export resource relationships as JSON
  158. terravision graphdata --source ~/src/my-terraform-code
  159. # Show only unique services used
  160. terravision graphdata --source ~/src/my-terraform-code --show_services
  161. # Export to custom filename
  162. terravision graphdata --source ~/src/my-terraform-code --outfile my-resources.json
  163. ```
  164. ## Advanced Features
  165. ### Use with annotations
  166. ```bash
  167. # Add your own custom annotations such as labels, resources or new connections
  168. terravision draw --source https://github.com/your-repo/terraform-examples.git --annotate ./custom-annotations.yml
  169. ```
  170. ### Working with Pre-generated JSON from previous terravision run (faster)
  171. ```bash
  172. # Export and reuse graph data
  173. terravision graphdata --source ~/src/terraform --outfile graph.json
  174. # Use previously exported JSON data (just the graph dict)
  175. terravision draw --source ./graph.json
  176. terravision draw --source ./graph.json --format svg
  177. # Reprocess and replay from previous debug (for troubleshooting without calling slow terraform init/plan/analayse again)
  178. terravision draw --source /your_source_files --debug # createas a tfdata.json in current folder
  179. terravision draw --source tfdata.json
  180. ```
  181. ### Debug Mode
  182. ```bash
  183. # Enable debug output for troubleshooting and which will dump all state info into tfdata.json
  184. terravision draw --source ~/src/my-terraform-code --debug
  185. ```
  186. ## AI-Powered Diagram Refinement
  187. TerraVision can use AI models to automatically refine and improve your architecture diagrams by fixing resource groupings, adding missing connections, and ensuring proper AWS architectural conventions.
  188. ### Supported AI Backends
  189. #### AWS Bedrock (Default)
  190. Uses AWS Bedrock API via API Gateway for cloud-based AI refinement.
  191. ```bash
  192. # Use Bedrock backend (default)
  193. terravision draw --source ~/src/my-terraform-code --aibackend bedrock
  194. ```
  195. **Configuration:**
  196. Edit `modules/cloud_config.py` to set your Bedrock API endpoint:
  197. ```python
  198. BEDROCK_API_ENDPOINT = "https://your-api-id.execute-api.us-east-1.amazonaws.com/prod/chat"
  199. ```
  200. #### Ollama (Local)
  201. Uses a local Ollama server for privacy-focused, offline AI refinement.
  202. ```bash
  203. # Use Ollama backend
  204. terravision draw --source ~/src/my-terraform-code --aibackend ollama
  205. ```
  206. **Setup:**
  207. 1. Install Ollama from https://ollama.ai/download
  208. 2. Start Ollama server and pull a model:
  209. ```bash
  210. # Start Ollama (runs automatically on macOS/Linux after install)
  211. ollama serve
  212. # Pull the llama3 model
  213. ollama pull llama3
  214. # Set model to stay loaded longer (optional, prevents premature unloading)
  215. # Default timeout is 5 minutes, extend to 1 hour:
  216. export OLLAMA_KEEP_ALIVE=1h
  217. ```
  218. 3. Edit `modules/cloud_config.py` to set your Ollama server (default is localhost):
  219. ```python
  220. OLLAMA_HOST = "http://localhost:11434"
  221. ```
  222. ### AI Refinement Prompts
  223. The AI models use specialized prompts defined in `modules/cloud_config.py`:
  224. - **AWS_REFINEMENT_PROMPT**: Guides the AI to fix resource groupings, connections, and ensure AWS best practices
  225. - **AWS_DOCUMENTATION_PROMPT**: Generates architecture summaries and documentation
  226. ### Setting Up AWS Bedrock Backend
  227. TerraVision includes Terraform code to deploy a serverless AWS Bedrock proxy with API Gateway:
  228. ```bash
  229. # Navigate to the Terraform directory
  230. cd ai-backend-terraform
  231. # Configure your settings
  232. cp terraform.tfvars.example terraform.tfvars
  233. # Edit terraform.tfvars with your settings
  234. # Deploy the infrastructure
  235. terraform init
  236. terraform apply
  237. # Get your API endpoint
  238. terraform output api_endpoint
  239. ```
  240. **Infrastructure Components:**
  241. - **API Gateway**: REST API with streaming support for real-time responses
  242. - **Lambda Function**: Node.js 20.x function with response streaming
  243. - **DynamoDB**: Rate limiting and usage tracking
  244. - **CloudWatch**: Monitoring, logging, and cost alerts
  245. - **IAM Roles**: Least-privilege access for Lambda to invoke Bedrock
  246. **Terraform Variables:**
  247. ```hcl
  248. variable "bedrock_model_id" {
  249. description = "Bedrock model ID"
  250. type = string
  251. }
  252. variable "rate_limit_per_hour" {
  253. description = "Maximum requests per client per hour"
  254. type = number
  255. default = 100
  256. }
  257. variable "cost_alert_threshold" {
  258. description = "Cost alert threshold in USD"
  259. type = number
  260. default = 50
  261. }
  262. ```
  263. After deployment, update `modules/cloud_config.py` with the output endpoint:
  264. ```python
  265. BEDROCK_API_ENDPOINT = "<your-api-endpoint-from-terraform-output>"
  266. ```
  267. # Annotating generated diagrams
  268. No automatically generated diagram is going to have all the detail you need, at best it will get you 80-90% of the way there. To add custom annotations such as a main diagram title, additional labels on arrows or additional resources created outside your Terraform, include a `terravision.yml` file in the source code folder and it will be automatically loaded. Alternatively, specify a path to the annotations file as a parameter to terravision.
  269. ``` bash
  270. terravision --source https://github.com/your-repo/terraform-examples.git --annotate /Users/me/MyDocuments/annotations.yml
  271. ```
  272. The .yml file is a standard YAML configuration file that is similar to the example below with one or more headings called `title`, `connect`, `disconnect`, `add`, `remove` or `update`. The node names follow the same conventions as Terraform resource names https://registry.terraform.io/providers/hashicorp/aws/latest/docs and support wildcards. You can add a custom label to any TF resource by modifying the attributes of the resource and adding the `label` attribute (doesn't exist in Terraform). For lines/connections, you can modify the resource attributes by adding terravision specific `edge_labels` to add text to the connection line to a specific resource node. See the example below:
  273. ``` yaml
  274. format: 0.1
  275. # Main Diagram heading
  276. title: Serverless Wordpress Site
  277. # Draw new connection lines that are not apparent from the Terraforms
  278. connect:
  279. aws_rds_cluster.this:
  280. - aws_ssm_parameter.db_master_user : Retrieve credentials from SSM
  281. # Remove connections between nodes that are currently shown
  282. disconnect:
  283. # Wildcards mean these disconnections apply to any cloudwatch type resource called logs
  284. aws_cloudwatch*.logs:
  285. - aws_ecs_service.this
  286. - aws_ecs_cluster.this
  287. # Delete the following nodes
  288. remove:
  289. - aws_iam_role.task_execution_role
  290. # Add the following nodes
  291. add:
  292. aws_subnet.another_one :
  293. # Specify Terraform attributes for a resource like this
  294. cidr_block: "123.123.1.1"
  295. # Modify attributes of existing node
  296. update:
  297. aws_ecs_service.this:
  298. # Add custom labels to the connection lines that already exist between ECS->RDS
  299. edge_labels:
  300. - aws_rds_cluster.this: Database Queries
  301. # Wildcards save you listing multiple resources of the same type. This edge label is added to all CF->ACM connections.
  302. aws_cloudfront* :
  303. edge_labels:
  304. - aws_acm_certificate.this: SSL Cert
  305. # Add a custom label to a resource node. Overrides default label
  306. aws_ecs_service.this :
  307. label: "My Custom Label"
  308. ```
  309. # Example Pipeline Configuration
  310. ```yaml
  311. # .github/workflows/infrastructure-docs.yml
  312. name: Update Architecture Diagrams
  313. on:
  314. push:
  315. branches: [main, develop]
  316. paths:
  317. - '**.tf'
  318. - '**.tfvars'
  319. jobs:
  320. update-diagrams:
  321. runs-on: ubuntu-latest
  322. steps:
  323. - uses: actions/checkout@v3
  324. - name: Setup Terraform
  325. uses: hashicorp/setup-terraform@v2
  326. - name: Setup Python
  327. uses: actions/setup-python@v4
  328. with:
  329. python-version: '3.10'
  330. - name: Install Graphviz
  331. run: sudo apt-get install -y graphviz
  332. - name: Install TerraVision
  333. run: |
  334. git clone https://github.com/patrickchugh/terravision.git
  335. cd terravision
  336. pip install -r requirements.txt
  337. - name: Generate Architecture Diagrams
  338. run: |
  339. terravision draw --source ./terraform --format svg --outfile architecture-${{ github.sha }}
  340. terravision draw --source ./terraform --format png --outfile architecture-${{ github.sha }}
  341. - name: Update Documentation Site
  342. run: |
  343. cp architecture-*.svg docs/images/
  344. cp architecture-*.png docs/images/
  345. # Update your docs (ReadTheDocs, MkDocs, etc.)
  346. - name: Publish to Confluence
  347. env:
  348. CONFLUENCE_TOKEN: ${{ secrets.CONFLUENCE_TOKEN }}
  349. run: |
  350. # Upload diagrams to Confluence page
  351. curl -X PUT "https://your-domain.atlassian.net/wiki/rest/api/content/$PAGE_ID" \
  352. -H "Authorization: Bearer $CONFLUENCE_TOKEN" \
  353. -H "Content-Type: application/json" \
  354. --data @confluence-update.json
  355. ```
  356. ## Command Reference
  357. ### Main Commands
  358. #### `terravision draw`
  359. Generates architecture diagrams from Terraform code.
  360. **Options:**
  361. - `--source` - Source location (folder, Git URL, or JSON file)
  362. - `--workspace` - Terraform workspace (default: "default")
  363. - `--varfile` - Path to .tfvars file (can be used multiple times)
  364. - `--outfile` - Output filename (default: "architecture")
  365. - `--format` - Output format: png, pdf, svg, bmp (default: png)
  366. - `--show` - Automatically open diagram after generation
  367. - `--simplified` - Generate simplified high-level diagram
  368. - `--annotate` - Path to custom annotations YAML file
  369. - `--aibackend` - AI backend for diagram refinement: bedrock, ollama (default: bedrock)
  370. - `--debug` - Enable debug output
  371. #### `terravision graphdata`
  372. Exports resource relationships and metadata as JSON.
  373. **Options:**
  374. - `--source` - Source location (folder, Git URL, or JSON file)
  375. - `--workspace` - Terraform workspace (default: "default")
  376. - `--varfile` - Path to .tfvars file (can be used multiple times)
  377. - `--outfile` - Output JSON filename (default: "architecture.json")
  378. - `--show_services` - Show only unique services list
  379. - `--annotate` - Path to custom annotations YAML file
  380. - `--aibackend` - AI backend for diagram refinement: bedrock, ollama
  381. - `--debug` - Enable debug output
  382. ### Global Options
  383. - `--version` - Show version information
  384. - `--help` - Show help message
  385. ## Supported File Types
  386. ### Input Sources
  387. - **Terraform files** (`.tf`, `.tf.json`)
  388. - **Variable files** (`.tfvars`, `.tfvars.json`)
  389. - **Git repositories** (HTTPS URLs)
  390. - **Pre-generated JSON** (`.json` graph data)
  391. - **Annotation files** (`.yml`, `.yaml`)
  392. ### Output Formats
  393. - **PNG** (default) - Raster image format
  394. - **SVG** - Scalable vector graphics
  395. - **PDF** - Portable document format
  396. - **BMP** - Bitmap image format
  397. - **JSON** - Graph data export
  398. ## Troubleshooting
  399. ### Common Issues
  400. 1. **"terraform command not found"**
  401. ```bash
  402. # Verify Terraform installation
  403. terraform version
  404. # Should show v1.x.x
  405. ```
  406. 2. **"dot command not found"**
  407. ```bash
  408. # Install Graphviz
  409. brew install graphviz # macOS
  410. sudo apt-get install graphviz # Ubuntu
  411. ```
  412. 3. **"Terraform version not supported"**
  413. - terravision requires Terraform v1.0.0 or higher
  414. - Upgrade Terraform: https://developer.hashicorp.com/terraform/downloads
  415. 4. **"No resources found"**
  416. - Ensure your Terraform code is valid
  417. - Run `terraform plan` to verify configuration
  418. - Check that source path contains `.tf` files
  419. 5. **"Cannot reach Ollama server"**
  420. - Verify Ollama is running: `curl http://localhost:11434/api/tags`
  421. - If server is unresponsive, kill existing processes:
  422. ```bash
  423. lsof -ti:11434 | xargs kill -9
  424. ollama serve
  425. ```
  426. - Ensure llama3 model is installed: `ollama pull llama3`
  427. 6. **"Stale or cached module issues"**
  428. - Clear the terravision cache folder:
  429. ```bash
  430. rm -rf ~/.terravision
  431. ```
  432. - This removes all cached modules and temporary files
  433. ### Debug Mode
  434. Use `--debug` flag for detailed troubleshooting information:
  435. ```bash
  436. terravision draw --source ~/src/terraform --debug
  437. ```
  438. This will:
  439. - Show detailed processing steps
  440. - Export intermediate JSON files
  441. - Display full error traces
  442. - Show detailed intermediate variable information
  443. ### Getting Help
  444. For detailed help on any command:
  445. ```bash
  446. terravision --help
  447. terravision draw --help
  448. terravision graphdata --help
  449. ```
  450. ## Performance Tips
  451. 1. **Large Terraform Projects**
  452. - Use `--simplified` for overview diagrams
  453. - Export to JSON first, then generate multiple diagram variants
  454. - Use specific workspaces to reduce scope
  455. 2. **CI/CD Integration**
  456. ```bash
  457. # Example CI pipeline step
  458. terravision draw --source . --format svg --outfile architecture-${BUILD_NUMBER}
  459. ```
  460. 3. **Batch Processing**
  461. ```bash
  462. # Generate multiple formats
  463. for format in png svg pdf; do
  464. terravision draw --source . --format $format --outfile arch-$format
  465. done
  466. ```
  467. ## Version Information
  468. **Recent Updates:**
  469. - Enhanced cloud provider support
  470. - Improved JSON export capabilities
  471. - Better error handling and debugging
  472. - Performance optimizations for large projects

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.