thothctl

ThothCTL Inventory Commands

Overview

The thothctl inventory command group provides tools for creating, managing, and updating inventories of your infrastructure components. These inventories help you track modules, their versions, sources, and dependencies, providing valuable insights into your infrastructure composition with modern, professional reporting and comprehensive analysis.

Recent Improvements ✨

Available Inventory Commands

inventory iac - Infrastructure as Code Inventory

Creates a comprehensive inventory of Infrastructure as Code (IaC) components in your project.

# Recommended: Comprehensive analysis with modern reporting
thothctl inventory iac --check-versions

# Basic inventory with modern HTML report
thothctl inventory iac

# Complete analysis with all report types
thothctl inventory iac --check-versions --report-type all

Key Features:

Common Options

Essential Options

Framework and Analysis Options

Action Options

Framework Types

thothctl inventory iac --framework-type auto --check-versions

Automatically detects the framework type and provides comprehensive analysis.

Terraform Framework

thothctl inventory iac --framework-type terraform --check-versions

Analyzes Terraform files (.tf) with modern reporting and version checking.

Terragrunt Framework

thothctl inventory iac --framework-type terragrunt --check-versions

Analyzes Terragrunt files (terragrunt.hcl) with provider version analysis.

Mixed Terraform-Terragrunt Framework

thothctl inventory iac --framework-type terraform-terragrunt --check-versions

Analyzes both Terraform and Terragrunt files with comprehensive reporting.

Report Types

Modern HTML Reports (Default) 🎨

thothctl inventory iac --check-versions --report-type html

Features:

JSON Reports for Automation

thothctl inventory iac --check-versions --report-type json

Features:

Combined Reports

thothctl inventory iac --check-versions --report-type all

Generates both modern HTML and JSON reports for comprehensive documentation and automation.

Quick Start Examples

Basic Infrastructure Audit

thothctl inventory iac --check-versions

What it does:

Comprehensive Analysis

thothctl inventory iac \
  --check-versions \
  --report-type all \
  --project-name "Production Infrastructure" \
  --inventory-path ./docs/infrastructure

What it does:

CI/CD Integration

thothctl inventory iac \
  --check-versions \
  --report-type json \
  --inventory-path ./reports/$(date +%Y-%m-%d)

What it does:

Use Cases

1. Infrastructure Auditing πŸ“Š

thothctl inventory iac --check-versions --report-type all

Benefits:

2. Documentation Generation πŸ“š

thothctl inventory iac \
  --check-versions \
  --project-name "Infrastructure Documentation" \
  --report-type html

Benefits:

3. Version Management πŸ”„

thothctl inventory iac --check-versions --report-type json

Benefits:

4. Compliance and Security πŸ”’

thothctl inventory iac \
  --check-versions \
  --complete \
  --report-type all

Benefits:

Best Practices

1. Regular Inventory Creation

# Weekly infrastructure health check
thothctl inventory iac --check-versions

2. Professional Documentation

# Generate business-ready reports
thothctl inventory iac \
  --check-versions \
  --project-name "$(basename $(pwd)) Infrastructure - $(date +%B\ %Y)" \
  --report-type html

3. Automation Integration

# CI/CD pipeline integration
thothctl inventory iac \
  --check-versions \
  --report-type json \
  --inventory-path ./reports/$(date +%Y-%m-%d)

4. Comprehensive Analysis

# Monthly comprehensive audit
thothctl inventory iac \
  --check-versions \
  --complete \
  --report-type all \
  --project-name "Monthly Infrastructure Audit"

Migration Guide

From Old Flags (Deprecated)

# Old approach with redundant flags
thothctl inventory iac --check-providers --check-provider-versions --check-versions
# New simplified approach
thothctl inventory iac --check-versions

Benefits:

Advanced Features

Provider Tool Selection

# Use OpenTofu (recommended for modern workflows)
thothctl inventory iac --check-versions --provider-tool tofu

# Use Terraform (for legacy workflows)
thothctl inventory iac --check-versions --provider-tool terraform

Complete Analysis

# Include normally excluded directories
thothctl inventory iac --check-versions --complete

Custom Output Organization

# Organized by environment and date
thothctl inventory iac \
  --check-versions \
  --inventory-path ./reports/production/$(date +%Y-%m) \
  --project-name "Production Infrastructure - $(date +%B\ %Y)"

v0.25.0 β€” CDK Construct Inventory

Starting with v0.25.0, thothctl inventory iac --check-versions supports AWS CDK projects (TypeScript and Python). CDK projects are auto-detected when a cdk.json file is present in the project root.

How It Works

Language Parsed Files Registry
TypeScript package.json + package-lock.json npm registry
Python requirements.txt / pyproject.toml PyPI

ThothCTL identifies CDK construct libraries (e.g., aws-cdk-lib, cdk-nag, @aws-cdk/aws-lambda-python-alpha) and checks the upstream registry for the latest published version and release date.

Usage

# In a CDK project directory (cdk.json present)
thothctl inventory iac --check-versions

Example Output

πŸ“¦ CDK Construct Inventory β€” my-cdk-app

  Package                        Current    Latest     Status     Released
  ─────────────────────────────────────────────────────────────────────────
  aws-cdk-lib                    2.140.0    2.155.0    Outdated   2026-07-15
  cdk-nag                        2.28.0     2.34.1     Outdated   2026-06-20
  constructs                     10.3.0     10.3.0     Current    2026-05-01
  @aws-cdk/aws-lambda-python-alpha  2.140.0-alpha.0  2.155.0-alpha.0  Outdated  2026-07-15
  @myorg/cdk-patterns            1.5.0      β€”          Internal   β€”

βœ… 3 outdated Β· 1 current Β· 1 internal (skipped)

Internal / Org-Scoped Packages

Packages with internal or organization scopes (e.g., @myorg/cdk-patterns) are detected and listed in the inventory but are not version-checked against a public registry. They appear with status Internal.

Release Dates

For every package checked against npm or PyPI, the release date of the latest version is fetched and displayed. This helps teams assess how far behind they are in calendar time, not just version numbers.

Report Integration

CDK inventory data flows into the same report pipeline:


v0.19.0 Changes

πŸ“¦ CycloneDX 1.6 SBOM Generation

Starting with v0.19.0, a CycloneDX 1.6 SBOM is always generated alongside HTML and JSON reports. This provides a standardized Software Bill of Materials for your infrastructure components.

# SBOM is automatically generated with every inventory run
thothctl inventory iac --check-versions

CycloneDX SBOM includes:

Section Content
Formulation IaC toolchain (Terraform/OpenTofu version, provider versions)
Lifecycles Build and deploy lifecycle phases
Evidence Source-code-analysis proof of component usage
Standards Organizational IaC policies (org-iac-policies)
Attestations Tech debt indicators and version currency
Dependencies Full DAG (Directed Acyclic Graph) of module relationships
Hashes SHA-256 integrity verification for all components
Licenses Inferred license information (MPL-2.0, Apache-2.0)

Package URL format: All components use the pkg:terraform/ PURL scheme for standard identification.

Compatible SBOM consumers:

πŸ“ Updated Report Paths

Reports are now organized under Reports/inventory/ for cleaner project structure:

Reports/
└── inventory/
    β”œβ”€β”€ html_reports/
    β”‚   └── InventoryIaC_<project>_<date>.html
    β”œβ”€β”€ InventoryIaC_<project>_<date>.json
    └── InventoryIaC_cyclonedx_<project>_<date>.json
Report Type Path
HTML Reports/inventory/html_reports/
JSON Reports/inventory/InventoryIaC_*.json
CycloneDX SBOM Reports/inventory/InventoryIaC_cyclonedx_*.json

Migration note: Reports previously written to Reports/ root are now placed in Reports/inventory/. The --inventory-path default is ./Reports.

πŸ“Š Dashboard Integration

The inventory integrates with the ThothCTL web dashboard for interactive exploration:

# Launch the dashboard
thothctl dashboard launch

Inventory Tab:

SBOM Details Tab:

# Generate inventory then explore in dashboard
thothctl inventory iac --check-versions
thothctl dashboard launch

Troubleshooting

Common Issues

  1. No Components Found: Ensure you’re in a directory with IaC files
  2. Version Check Failures: Verify internet connectivity and module accessibility
  3. Provider Analysis Issues: Ensure provider tools are installed and initialized
  4. Report Generation Problems: Check write permissions to output directory

Getting Help

# Detailed command help
thothctl inventory iac --help

# Debug mode for troubleshooting
thothctl --debug inventory iac --check-versions

Summary

The ThothCTL inventory commands now provide:

Recommended command for most users:

thothctl inventory iac --check-versions

This provides comprehensive analysis with modern reporting in a single, simple command.