Skip to content

owenrumney/tf-nav

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

12 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Terraform Navigator (tf-nav)

Visual Studio Marketplace Downloads Rating

Navigate your Terraform infrastructure with ease! Terraform Navigator provides a powerful tree view and dependency graph visualization for your Terraform configurations, making it simple to understand and navigate complex infrastructure code.

tf-nav preview

โœจ Features

๐ŸŒณ Smart Tree Navigation

  • Hierarchical File View: Browse your Terraform files in their actual directory structure
  • Resource Type View: Group resources by type (aws_instance, aws_security_group, etc.)
  • Instant Code Navigation: Click any resource to jump directly to its definition
  • Real-time Updates: Automatically refreshes when you modify Terraform files

๐Ÿ“Š Interactive Dependency Graph

  • Visual Dependencies: See how your resources connect and depend on each other
  • Interactive Exploration: Click nodes to focus on specific resources and their relationships
  • Provider-Aware Styling: Resources are color-coded by provider (AWS, Azure, GCP, etc.)
  • Full Resource Names: Displays complete provider prefixes (aws_instance, azurerm_virtual_machine, etc.)
  • Navigation History: Back/forward buttons to navigate through your exploration

๐Ÿš€ Productivity Features

  • Copy Terraform Addresses: Right-click to copy fully qualified resource addresses
  • Quick Search: Find resources instantly in large Terraform projects
  • Multi-Provider Support: Works with AWS, Azure, GCP, and all other Terraform providers
  • Performance Optimized: Uses worker threads for large workspaces (500+ files)

๐ŸŽฏ Perfect For

  • DevOps Engineers managing complex infrastructure
  • Platform Teams working with large Terraform codebases
  • Cloud Architects designing multi-service systems
  • Anyone who wants to understand Terraform dependencies visually

๐Ÿ“ธ Screenshots

Tree View Navigation

The extension provides two powerful ways to navigate your Terraform code:

By File Structure - Navigate your Terraform files just like in the file explorer, but with block counts:

๐Ÿ“ terraform-project
โ”œโ”€โ”€ ๐Ÿ“„ main.tf (8 blocks)
โ”œโ”€โ”€ ๐Ÿ“„ variables.tf (12 blocks)
โ””โ”€โ”€ ๐Ÿ“ modules (2 files)
    โ”œโ”€โ”€ ๐Ÿ“ networking (3 files)
    โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ main.tf (5 blocks)
    โ”‚   โ””โ”€โ”€ ๐Ÿ“„ variables.tf (8 blocks)
    โ””โ”€โ”€ ๐Ÿ“ database (3 files)
        โ””โ”€โ”€ ๐Ÿ“„ main.tf (4 blocks)

By Resource Type - Group resources by their type for better organization:

๐Ÿ—๏ธ Resources
โ”œโ”€โ”€ ๐Ÿ“ฆ aws_instance (3)
โ”œโ”€โ”€ ๐Ÿ”’ aws_security_group (2)
โ”œโ”€โ”€ ๐ŸŒ aws_vpc (1)
โ””โ”€โ”€ ๐Ÿ—„๏ธ aws_db_instance (1)
๐Ÿ”ง Variables (12)
๐Ÿ“ค Outputs (6)
๐Ÿ“ฆ Modules (2)

Interactive Dependency Graph

Visualize how your Terraform resources connect:

  • Nodes: Represent resources, variables, modules, and outputs
  • Edges: Show dependencies between components
  • Colors: Provider-specific styling (AWS=Orange, Azure=Blue, etc.)
  • Navigation: Click nodes to explore, use back/forward to navigate

๐Ÿ› ๏ธ Installation

  1. Open VS Code
  2. Go to Extensions (Ctrl+Shift+X)
  3. Search for "Terraform Navigator"
  4. Click Install

Or install from the VS Code Marketplace.

๐ŸŽฎ Usage

Getting Started

  1. Open any folder containing Terraform files (.tf or .tf.json)
  2. The Terraform Navigator panel will appear in the sidebar
  3. Click the ๐Ÿ”„ refresh button to build the initial index
    • The button will show "โณ Refreshing..." while processing
    • Large projects may take a few moments to complete
  4. Start exploring your infrastructure!

View Modes

  • ๐Ÿ“ File View: Click the folder icon to browse by directory structure
  • ๐Ÿท๏ธ Type View: Default view that groups resources by type
  • ๐Ÿ”— Graph View: Click the link icon to open the interactive dependency graph

Navigation

  • Single-click: Select and highlight a resource
  • Double-click: Jump to the resource definition in your code
  • Right-click: Access context menu (copy address, show in graph, etc.)

Dependency Graph

  • Click nodes: Focus on specific resources and their immediate dependencies
  • Right-click nodes: Reveal in editor, copy address, or focus dependencies
  • Back/Forward: Navigate through your exploration history
  • Keyboard shortcuts: Enter to reveal, Ctrl+C to copy selected node

โš™๏ธ Configuration

Customize the extension in your VS Code settings:

{
  // How to organize the tree view
  "tfnav.viewMode": "type", // "file" | "type"

  // Include data sources in the tree view
  "tfnav.includeDataSources": true,

  // Include .terraform directory (downloaded modules and providers)
  // โš ๏ธ WARNING: This can significantly impact performance in large projects
  "tfnav.includeTerraformCache": false,

  // Files/directories to ignore (supports glob patterns)
  "tfnav.ignore": [
    "**/.terraform/**", // Excluded by default for performance
    "**/terraform.tfstate*", // State files
    "**/.terragrunt-cache/**" // Terragrunt cache
  ]
}

๐Ÿ—‚๏ธ .terraform Directory Parsing

The extension can optionally parse the .terraform directory, which contains:

  • Downloaded Modules: Remote modules fetched during terraform init
  • Provider Plugins: Downloaded provider binaries and schemas
  • Lock Files: Dependency lock information

๐Ÿšจ Performance Impact

Parsing .terraform directories can significantly slow down the extension, especially for:

  • Projects with many remote modules
  • Large provider schemas
  • Complex dependency trees

Recommendations:

  • โœ… Keep disabled (default) for daily development work
  • โœ… Enable temporarily when you need to analyze downloaded module dependencies
  • โœ… Use with caution in monorepos or large Terraform workspaces

When to Enable:

  • Debugging module dependency issues
  • Understanding how downloaded modules interact
  • Analyzing the full dependency graph including external modules

To Enable:

{
  "tfnav.includeTerraformCache": true
}

๐Ÿš€ Performance Features

  • Smart Caching: Parses only changed files for lightning-fast updates
  • Worker Threads: Offloads parsing to background threads for large projects
  • Incremental Updates: Only rebuilds what's necessary when files change
  • Memory Efficient: LRU cache with automatic cleanup
  • Selective Parsing: Excludes .terraform directories by default for optimal performance
  • Visual Feedback: Refresh button shows loading state during index rebuilding

๐Ÿ”ง Supported Terraform Features

Block Types

  • โœ… Resources (resource "aws_instance" "web")
  • โœ… Data Sources (data "aws_ami" "ubuntu")
  • โœ… Modules (module "vpc")
  • โœ… Variables (variable "region")
  • โœ… Outputs (output "instance_ip")
  • โœ… Locals (locals { ... })

File Types

  • โœ… .tf files (HCL syntax)
  • โœ… .tf.json files (JSON syntax)

Providers

  • โœ… AWS, Azure, Google Cloud Platform
  • โœ… Kubernetes, Docker, Helm
  • โœ… GitHub, GitLab, Datadog
  • โœ… All community providers

๐Ÿค Contributing

Found a bug or have a feature request?

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿท๏ธ Keywords

terraform, infrastructure, devops, aws, azure, gcp, navigation, dependency, graph, visualization, hcl, infrastructure-as-code

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •