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.
- 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
- 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
- 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)
- 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
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)
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
- Open VS Code
- Go to Extensions (Ctrl+Shift+X)
- Search for "Terraform Navigator"
- Click Install
Or install from the VS Code Marketplace.
- Open any folder containing Terraform files (.tf or .tf.json)
- The Terraform Navigator panel will appear in the sidebar
- 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
- Start exploring your infrastructure!
- ๐ 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
- 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.)
- 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
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
]
}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
}- 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
.terraformdirectories by default for optimal performance - Visual Feedback: Refresh button shows loading state during index rebuilding
- โ
Resources (
resource "aws_instance" "web") - โ
Data Sources (
data "aws_ami" "ubuntu") - โ
Modules (
module "vpc") - โ
Variables (
variable "region") - โ
Outputs (
output "instance_ip") - โ
Locals (
locals { ... })
- โ
.tffiles (HCL syntax) - โ
.tf.jsonfiles (JSON syntax)
- โ AWS, Azure, Google Cloud Platform
- โ Kubernetes, Docker, Helm
- โ GitHub, GitLab, Datadog
- โ All community providers
Found a bug or have a feature request?
- ๐ Report Issues: GitHub Issues
- ๐ก Feature Requests: GitHub Discussions
- โญ Star the Project: GitHub Repository
This project is licensed under the MIT License - see the LICENSE file for details.
terraform, infrastructure, devops, aws, azure, gcp, navigation, dependency, graph, visualization, hcl, infrastructure-as-code
