Inventory
Inventory provides a complete catalog of your Terraform-managed infrastructure. Browse resources, modules, and types. Query your data with SQL. Build dashboards and find resources that aren't managed by Terraform.
Features
Browse Resources
- Instances - All resource instances across all states
- Modules - Terraform module breakdown
- Resource Types - Resources grouped by type
Query & Analyze
- Query (SQL) - SQL queries across your infrastructure
- Dashboards - Save and share custom views
- Gap Analysis - Find unmanaged cloud resources
Navigating Inventory
In the Stategraph UI, the Inventory section is accessible from the left sidebar. It provides:
Inventory
├── Instances → Browse all resource instances
├── Modules → View Terraform modules
├── Types → Resources by type
├── Query → Run SQL queries
├── Dashboards → Custom dashboard views
└── Gap Analysis → Unmanaged resource detection
Use Cases
Infrastructure Catalog
Use Inventory as your infrastructure CMDB:
- Centralized view of all Terraform-managed resources
- Search and filter across all states and workspaces
- View resource attributes and dependencies
- Track resource counts by type, module, or provider
Compliance & Auditing
- Query resources by tags or attributes
- Find resources missing required tags
- Identify resources by region or account
- Generate reports for compliance reviews
Resource Discovery
- Find resources across multiple Terraform states
- Identify duplicate or similar resources
- Discover resources by naming patterns
- Gap analysis to find unmanaged resources
Quick Examples
Find all EC2 instances
Navigate to Types and select aws_instance, or run this query:
SELECT i.address, i.attributes->>'instance_type' AS instance_type
FROM instances AS i
INNER JOIN resources AS r
ON i.resource_address = r.address AND i.state_id = r.state_id
WHERE r.type = 'aws_instance'
Count resources by type
SELECT type, count(*) AS total
FROM resources
GROUP BY type
ORDER BY type
Find untagged resources
SELECT address
FROM instances
WHERE attributes->'tags' IS NULL
OR attributes->>'tags' = '{}'
Getting Started
- Deploy Stategraph if you haven't already
- Set up Velocity to populate inventory
- Browse Instances to see your resources
- Try a Query to explore your data
Next Steps
- Instances - Browse resource instances
- Query Language - Learn SQL syntax
- Gap Analysis - Find unmanaged resources