The thothctl inventory iac command creates, updates, and manages an inventory of Infrastructure as Code (IaC) components in your project. This inventory tracks modules, their versions, sources, and dependencies, providing valuable insights into your infrastructure composition with modern, professional HTML reports and comprehensive provider version analysis.
--publish-sbom dependency-track)-cv) and provider versions (-cpv) — check what you needUsage: thothctl inventory iac [OPTIONS]
Create a inventory about IaC modules composition for terraform/tofu/terragrunt projects
Options:
-cv, --check-versions Check latest versions for modules
-cpv, --check-provider-versions Check latest versions for providers
--check-providers Check and report provider information for each stack
-ft, --framework-type [auto|terraform|terragrunt|terraform-terragrunt|module|cdkv2]
Framework type to analyze (auto for automatic detection)
-r, --report-type [html|json|cyclonedx|all]
Type of report to generate
--publish-sbom [dependency-track|defectdojo|secobserve]
Publish CycloneDX SBOM to external platform after generation
--product-group TEXT SecObserve product group for a newly created product
(requires --publish-sbom secobserve)
-iact, --inventory-action [create|update|restore]
Action for inventory tasks
-iph, --inventory-path PATH Path for saving inventory reports
-pj, --project-name TEXT Custom project name for the report
--provider-tool [tofu|terraform]
Tool to use for checking providers (default: tofu)
--complete Include .terraform and .terragrunt-cache in analysis
-auto, --auto-approve Auto approve updating dependencies
--post-to-pr Post inventory summary as a PR comment
(Azure DevOps or GitHub)
--vcs-provider [auto|azure_repos|github]
VCS provider for PR comments (default:
auto-detect from CI environment)
--space TEXT Space name for credential resolution
(Azure DevOps)
--help Show this message and exit.
thothctl inventory iac
This creates an inventory of all IaC components in the current directory and generates a modern HTML report in the default location (./Reports/Inventory).
# Check module versions only
thothctl inventory iac -cv
# Check provider versions only
thothctl inventory iac -cpv
# Check both module and provider versions
thothctl inventory iac -cv -cpv
# Provider info without version lookup
thothctl inventory iac --check-providers
# HTML report with modern styling (default)
thothctl inventory iac --report-type html
# JSON report for automation
thothctl inventory iac --report-type json
# CycloneDX SBOM report (OWASP standard)
thothctl inventory iac --report-type cyclonedx
# All report types (HTML, JSON, and CycloneDX)
thothctl inventory iac --report-type all
thothctl inventory iac \
-cv -cpv \
--inventory-path ./docs/infrastructure \
--project-name "Production Infrastructure"
The new HTML reports feature:
ThothCTL now supports generating CycloneDX Software Bill of Materials (SBOM) reports, following the OWASP CycloneDX standard:
# Generate CycloneDX SBOM for security audit
thothctl inventory iac -cv -cpv --report-type cyclonedx
# Complete analysis with all formats including SBOM
thothctl inventory iac -cv -cpv --report-type all
The CycloneDX report includes:
Publish your CycloneDX SBOM directly to OWASP Dependency-Track for centralized vulnerability management:
BOM_UPLOAD (required)VIEW_PORTFOLIO (recommended — allows project lookup)PROJECT_CREATION_UPLOAD (only if auto_create = true)To create an API key: Administration → Access Management → Teams → select team → API Keys → Generate
auto_create = true)
DTRACK_PROJECT_UUID to skip auto-creation and avoid needing PROJECT_CREATION_UPLOAD permission# Generate SBOM and publish to Dependency-Track in one command
thothctl inventory iac --check-versions --publish-sbom dependency-track
# With custom project name
thothctl inventory iac --check-versions --publish-sbom dependency-track \
--project-name "my-platform-infra"
Configuration (priority: env vars > .thothcf.toml):
# Environment variables
export DTRACK_URL="https://dtrack.example.com"
export DTRACK_API_KEY="your-api-key"
export DTRACK_PROJECT_NAME="my-project" # Optional (auto-detected from SBOM)
export DTRACK_PROJECT_VERSION="latest" # Optional (default: latest)
export DTRACK_PROJECT_UUID="uuid-here" # Optional (use existing project, skips auto-create)
Or in .thothcf.toml:
[integrations.dependency_track]
url = "https://dtrack.example.com"
api_key = "your-api-key"
project_name = "my-platform-infra"
project_version = "latest"
auto_create = true # Create project if it doesn't exist
project_uuid = "" # Optional: use existing project UUID (skips auto-create)
parent_project = "org-parent" # Optional: nest under parent project
CI/CD Integration:
# GitHub Actions
- name: Inventory + Publish to Dependency-Track
env:
DTRACK_URL: $
DTRACK_API_KEY: $
run: |
thothctl inventory iac --check-versions \
--publish-sbom dependency-track \
--project-name "$"
Features:
--project-namePublish your CycloneDX SBOM to OWASP DefectDojo for vulnerability management and security orchestration:
Token <your-api-key> (ThothCTL handles the prefix)# Generate SBOM and publish to DefectDojo
thothctl inventory iac --check-versions --publish-sbom defectdojo
# With custom product name
thothctl inventory iac --check-versions --publish-sbom defectdojo \
--project-name "my-platform-infra"
Configuration (priority: env vars > .thothcf.toml):
# Environment variables
export DEFECTDOJO_URL="http://defectdojo.example.com:8090"
export DEFECTDOJO_TOKEN="your-api-token"
export DEFECTDOJO_PRODUCT_NAME="my-project" # Optional (uses --project-name)
export DEFECTDOJO_ENGAGEMENT_NAME="IaC Inventory" # Optional (default: "IaC Supply Chain Inventory")
Or in .thothcf.toml:
[integrations.defectdojo]
url = "http://defectdojo.example.com:8090"
token = "your-api-token"
product_name = "my-platform-infra"
product_type_name = "Infrastructure" # Product type category
engagement_name = "IaC Supply Chain Inventory"
auto_create = true # Create product/engagement if they don't exist
close_old_findings = true # Close findings no longer in SBOM
deduplication_on_engagement = true # Deduplicate within engagement
CI/CD Integration:
# GitHub Actions
- name: Inventory + Publish to DefectDojo
env:
DEFECTDOJO_URL: $
DEFECTDOJO_TOKEN: $
run: |
thothctl inventory iac --check-versions \
--publish-sbom defectdojo \
--project-name "$"
Features:
/api/v2/reimport-scan/ endpoint (idempotent — safe to run repeatedly)Publish your CycloneDX SBOM and scan results to SecObserve for unified vulnerability and license management:
APIToken <your-token> (ThothCTL handles the prefix)auto_create_product = true). Products can be placed in a product group to share security gate settings# Publish SBOM for license tracking
thothctl inventory iac --check-versions --publish-sbom secobserve
# Publish scan findings (all scanners supported via SARIF)
thothctl scan iac -t checkov -t trivy -t kics -t opa --publish-to secobserve
# Create new products inside a product group (SBOM and scans)
thothctl inventory iac --check-versions --publish-sbom secobserve --product-group platform-team
thothctl scan iac -t checkov --publish-to secobserve --product-group platform-team
# Publish and let the SecObserve security gate decide pass/fail
thothctl scan iac -t checkov -t kics --publish-to secobserve \
--gate-source secobserve --enforcement hard
Configuration (priority: env vars > .thothcf.toml):
# Environment variables
export SECOBSERVE_URL="http://secobserve-backend.localhost"
export SECOBSERVE_API_TOKEN="api_token_..."
export SECOBSERVE_PRODUCT_NAME="my-project" # Optional (uses --project-name)
export SECOBSERVE_PRODUCT_GROUP="platform-team" # Optional (group for new products; --product-group overrides)
export SECOBSERVE_BRANCH_NAME="main" # Recommended (see note below)
export SECOBSERVE_ORIGIN_SERVICE="my-service" # Optional (service for scans and SBOMs)
export SECOBSERVE_AUTO_CREATE="true" # Optional (default: true)
Or in .thothcf.toml:
[integrations.secobserve]
url = "http://secobserve-backend.localhost"
api_token = "api_token_..."
product_name = "my-platform-infra"
product_group = "platform-team" # optional; group for products ThothCTL creates
branch_name = "main"
origin_service = "thothctl" # optional; sent as SecObserve "service"
auto_create_product = true
!!! note “Branch name”
The first branch imported for a product becomes its default branch, and SecObserve computes the security gate only for that branch. Always set SECOBSERVE_BRANCH_NAME in CI (for example main, or the PR branch). Without it, a product that already has a default branch can’t be gated (--gate-source secobserve reports UNKNOWN).
!!! note “Service name”
By default each tool’s scan findings are attributed to a service with the tool’s name (kics, checkov, …). Setting origin_service sends that value as the SecObserve service for all tools, and for SBOM uploads, instead. Findings are still tracked separately per tool, because each tool uses its own upload file. SBOMs get no service unless origin_service is set.
!!! note “Product group”
--product-group (or product_group) only applies to products that ThothCTL creates. Existing products are never moved between groups; a warning is shown instead. See Product groups.
CI/CD Integration:
# GitHub Actions
- name: Scan + Publish to SecObserve
env:
SECOBSERVE_URL: $
SECOBSERVE_API_TOKEN: $
SECOBSERVE_BRANCH_NAME: $
run: |
thothctl inventory iac --check-versions \
--publish-sbom secobserve \
--project-name "$"
thothctl scan iac -t checkov -t trivy -t kics -t opa \
--publish-to secobserve \
--gate-source secobserve --enforcement hard \
-p "$"
Supported scanners (all published via SARIF, one file per tool):
| Scanner | Uploaded file | Notes |
|---|---|---|
| Checkov | thothctl-checkov.sarif |
SARIF generated from scan results |
| Trivy | thothctl-trivy.sarif |
SARIF generated from scan results |
| KICS | kics-results.sarif |
Native .sarif output used directly |
| OPA/Conftest | thothctl-opa.sarif |
SARIF generated from policy violations |
| terraform-compliance | thothctl-terraform-compliance.sarif |
SARIF generated from scan results |
Features:
--product-group)--gate-source secobserve|both — see Security Gate Source.localhost domain resolution (Traefik/Docker setups)The --check-versions flag now provides comprehensive analysis:
thothctl inventory iac --check-versions
What it does:
If you only want provider information without version checking:
thothctl inventory iac --check-providers
The reports now include comprehensive provider data:
When --check-versions is enabled, ThothCTL calculates a technical debt score that reflects how outdated your infrastructure is.
The debt score uses a weighted approach that separates module health from provider health:
module_debt = outdated_modules / total_modules (weight: 70%)
provider_debt = outdated_providers / total_providers (weight: 30%)
debt_score = (module_debt × 0.7 + provider_debt × 0.3) × 100 + breaking_changes_penalty
Why weighted? Modules define your architecture and are the primary source of risk. Providers are dependencies that may be intentionally pinned (e.g., a latest module tested against a specific provider version). A single outdated provider should not inflate the score disproportionately.
Each module or provider with detected breaking changes adds +5 points to the debt score (capped at 100%).
| Debt Score | Risk Level | Meaning |
|---|---|---|
| ≥ 70% | Critical | Immediate action required |
| ≥ 50% | High | Plan upgrades soon |
| ≥ 30% | Medium | Schedule maintenance |
| < 30% | Low | Infrastructure is well-maintained |
| Scenario | Score | Risk |
|---|---|---|
| 2 modules current, 1/2 providers outdated | 15% | Low |
| 2/4 modules outdated, providers current | 35% | Medium |
| All modules and providers outdated | 100% | Critical |
| Everything current | 0% | Low |
The system auto-generates actionable recommendations based on the metrics:
The inventory iac command now supports AWS CDK projects (TypeScript and Python). When cdk.json is detected in your project, ThothCTL automatically switches to CDK inventory mode.
# In a CDK TypeScript project
thothctl inventory iac --check-versions
# Detects constructs: aws-cdk-lib, cdk-nag, @myorg/cdk-patterns, constructs, etc.
Parses package.json and package-lock.json to identify CDK construct libraries, then queries the npm registry for latest versions and release dates.
# In a CDK Python project
thothctl inventory iac --check-versions
# Detects constructs: aws-cdk-lib, cdk-nag, constructs, etc.
Parses requirements.txt or pyproject.toml to identify CDK construct libraries, then queries PyPI for latest versions and release dates.
You can also explicitly select CDK mode:
thothctl inventory iac --framework-type cdkv2 --check-versions
cdk.json exists, CDK mode is selected automatically (no --framework-type needed)@myorg/cdk-patterns) are listed but not version-checkedpkg:npm/ or pkg:pypi/ PURL schemesthothctl inventory iac --framework-type auto
Automatically detects the framework type based on project files.
thothctl inventory iac --framework-type terraform --check-versions
Analyzes Terraform files (.tf) with version checking.
thothctl inventory iac --framework-type terragrunt --check-versions
Analyzes Terragrunt files (terragrunt.hcl) with comprehensive provider analysis.
thothctl inventory iac --framework-type terraform-terragrunt --check-versions
Analyzes both Terraform and Terragrunt files with full version checking.
thothctl inventory iac --inventory-action create --check-versions
Scans IaC files and creates a new inventory with version analysis.
thothctl inventory iac \
--inventory-action update \
--inventory-path ./path/to/inventory.json \
--auto-approve
Updates IaC files based on the inventory.
thothctl inventory iac \
--inventory-action restore \
--inventory-path ./path/to/inventory.json
Restores IaC files to the state recorded in the inventory.
thothctl inventory iac \
--check-versions \
--report-type all \
--project-name "Production Infrastructure Audit" \
--inventory-path ./docs/audit
This generates:
thothctl inventory iac \
--framework-type terragrunt \
--check-versions \
--project-name "Terragrunt Infrastructure"
# In your CI/CD pipeline
thothctl inventory iac \
--check-versions \
--report-type json \
--inventory-path ./reports/$(date +%Y-%m-%d)
# Post inventory summary as a PR comment
thothctl inventory iac --check-versions --post-to-pr
The --post-to-pr flag posts an inventory summary table directly to the pull request, including component counts, provider stats, and technical debt metrics.
# GitHub Actions example
- run: thothctl inventory iac --check-versions --post-to-pr
env:
GITHUB_TOKEN: $
# Azure Pipelines example (uses built-in System.AccessToken, no PAT needed)
- script: thothctl inventory iac --check-versions --post-to-pr
env:
AZDO_PERSONAL_ACCESS_TOKEN: $(System.AccessToken)
Platform comment size limits (GitHub: 65K chars, Azure DevOps: 150K chars) are enforced automatically with truncation. See check iac PR comment docs for full platform setup details, including required Azure DevOps build service permissions.
thothctl inventory iac \
--check-versions \
--complete \
--report-type all \
--project-name "Complete Infrastructure Analysis" \
--provider-tool tofu \
--inventory-path ./comprehensive-analysis
{
"version": 2,
"projectName": "my-project",
"projectType": "terraform-terragrunt",
"components": [
{
"stack": "./stacks/networking",
"components": [
{
"type": "module",
"name": "vpc",
"version": ["5.0.0"],
"source": ["terraform-aws-modules/vpc/aws"],
"latest_version": "5.19.0",
"source_url": "https://registry.terraform.io/modules/terraform-aws-modules/vpc/aws",
"status": "Outdated"
}
],
"providers": [
{
"name": "aws",
"version": "6.0.0",
"source": "registry.opentofu.org/hashicorp/aws",
"module": "Root",
"component": "networking",
"latest_version": "6.2.0",
"status": "outdated"
}
]
}
],
"provider_version_stats": {
"total_providers": 15,
"outdated_providers": 3,
"current_providers": 12,
"unknown_providers": 0
}
}
thothctl inventory iac --check-versions --report-type all
Benefits:
# Create inventory with version analysis
thothctl inventory iac --check-versions --report-type json
# Review the generated report for outdated components
# Update modules based on findings
thothctl inventory iac \
--check-versions \
--project-name "Production Infrastructure Documentation" \
--report-type html
Generates professional documentation with:
thothctl inventory iac \
--check-versions \
--complete \
--report-type all
Helps with:
# In your pipeline
thothctl inventory iac \
--check-versions \
--report-type json \
--inventory-path ./reports/$(date +%Y-%m-%d)
# Parse JSON output for automated decision making
# Run weekly to identify outdated components
thothctl inventory iac --check-versions
# For thorough audits, use all features
thothctl inventory iac \
--check-versions \
--complete \
--report-type all \
--project-name "Monthly Infrastructure Audit"
# Generate consistent documentation
thothctl inventory iac \
--check-versions \
--project-name "$(basename $(pwd)) Infrastructure" \
--inventory-path ./docs/infrastructure
# Use OpenTofu for modern Terraform workflows
thothctl inventory iac --check-versions --provider-tool tofu
# Use Terraform for legacy workflows
thothctl inventory iac --check-versions --provider-tool terraform
# Organize reports by date and environment
thothctl inventory iac \
--check-versions \
--inventory-path ./reports/$(date +%Y-%m)/production \
--project-name "Production Infrastructure - $(date +%B\ %Y)"
The recent updates have resolved all CSS variable issues that previously caused HTML report generation failures.
Error: Failed to check versions for module xyz
Solution: Ensure internet connectivity and module source accessibility.
Error: Failed to get providers for stack xyz
Solution:
tofu init or terraform init in problematic directoriesError: Failed to generate HTML report
Solution: Ensure write permissions to the output directory.
For detailed logs:
thothctl --debug inventory iac --check-versions
# Old redundant flags
thothctl inventory iac --check-providers --check-provider-versions --check-versions
# New unified approach
thothctl inventory iac --check-versions
Benefits of the new approach:
The thothctl inventory iac command now provides:
--check-versions flagUse thothctl inventory iac --check-versions for the best experience with comprehensive analysis and modern reporting.