Inventory

Inventory provides a complete catalog of your Terraform-managed infrastructure. Browse resources, modules, and types. Query your data with MQL. Build dashboards and find resources that aren't managed by Terraform.

Features

Browse Resources

Query & Analyze

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 MQL 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 i
JOIN resources r ON i.resource_address = r.address AND i.state_id = r.state_id
WHERE r.type = 'aws_instance'

Count resources by type

SELECT r.type, count(*) as count
FROM resources r
GROUP BY r.type
ORDER BY r.type

Find untagged resources

SELECT i.address, r.type
FROM instances i
JOIN resources r ON i.resource_address = r.address AND i.state_id = r.state_id
WHERE r.type LIKE 'aws_%'
  AND (i.attributes->'tags' IS NULL
       OR i.attributes->>'tags' = '{}')

Getting Started

  1. Deploy Stategraph if you haven't already
  2. Store Terraform state to populate inventory
  3. Browse Instances to see your resources
  4. Try a Query to explore your data

Next Steps