The thothctl check command group provides tools for validating various aspects of your infrastructure code, project structure, and environment. These commands help ensure that your projects follow best practices, adhere to defined structures, and meet security requirements.
Validates Infrastructure as Code (IaC) artifacts — plans, costs, blast radius, drift, and project structure.
thothctl check iac [OPTIONS]
Options:
| Flag | Description |
|---|---|
-type, --check_type |
Check type: tfplan, deps, blast-radius, cost-analysis, drift, stack-optimizer |
--mode [soft\|hard] |
Validation mode (default: soft) |
--recursive |
Validate recursively or in one directory |
-deps, --dependencies |
View dependency graph in ASCII |
--outmd |
Output markdown file path |
--plan-file |
Path to tfplan.json for plan-based analysis |
--filter-tags |
Tag filter for drift detection (e.g., env=prod,team=platform) |
--tftool |
Use terraform or tofu (default: tofu) |
Check types:
| Type | Description |
|---|---|
tfplan |
Validate Terraform plan file |
deps |
Dependency analysis and graph |
blast-radius |
Change impact assessment (ITIL v4 risk classification) |
cost-analysis |
AWS cost estimation (17 service providers) |
drift |
Infrastructure drift detection with AI analysis |
stack-optimizer |
DAG dependency optimization for Terragrunt |
This command can validate:
Detailed documentation for check iac
Validates project configuration and structure.
thothctl check project [OPTIONS]
This command is currently under development.
Validates the development environment and required tools.
thothctl check environment [OPTIONS]
This command is currently under development.
The check iac command validates your project structure against rules defined in the .thothcf.toml file. The validation includes:
[project_structure]
root_files = [
".gitignore",
".pre-commit-config.yaml",
"README.md"
]
ignore_folders = [
".git",
".terraform",
"Reports"
]
[[project_structure.folders]]
name = "modules"
mandatory = true
content = [
"variables.tf",
"main.tf",
"outputs.tf",
"README.md"
]
type = "root"
[[project_structure.folders]]
name = "environments"
mandatory = true
type = "root"
The check commands support two validation modes:
thothctl check iac --mode hard
Add check commands to your CI/CD pipeline to validate infrastructure code before deployment:
# Example GitHub Actions workflow
jobs:
validate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install ThothCTL
run: pip install thothctl
- name: Validate IaC
run: thothctl check iac --mode hard
Use check commands in pre-commit hooks to validate changes before committing:
# .pre-commit-config.yaml
repos:
- repo: local
hooks:
- id: thothctl-check-iac
name: ThothCTL Check IaC
entry: thothctl check iac
language: system
pass_filenames: false
Run check commands during development to ensure your code meets requirements:
# Before submitting a pull request
thothctl check iac --check_type project
thothctl check iac
thothctl check iac --check_type module --mode hard
thothctl check iac --check_type tfplan --recursive recursive --outmd
thothctl check iac --dependencies
.thothcf.toml fileUsing default options
Solution: Create a .thothcf.toml file with your project structure rules.
❌ - Required file main.tf missing in modules/network
Project structure is invalid
Solution: Add the missing file or update your structure rules if the file is not actually required.
Error: [Errno 13] Permission denied: '/path/to/directory'
Solution: Ensure you have read permissions for all directories being validated.
For more detailed logs, run ThothCTL with the --debug flag:
thothctl --debug check iac