Skip to main content

STIG Automator

Evaluate Terraform plan and state JSON files against DISA STIG controls for Azure and AWS resources.

STIG Automator auto-detects resources in your Terraform plan, runs the applicable STIG checks, and reports which controls are met or not met — all from static analysis, with no cloud API calls required.

Triage tool only. STIG Automator helps prioritize review of Terraform plans. It does not guarantee compliance, completeness, or correctness. Every control result must be validated by a human before it is used for authorization, accreditation, or audit evidence.

Features

  • Auto-detection — scans your Terraform plan for known resource types and runs the matching STIG modules automatically
  • Modular architecture — each STIG is a self-contained module; adding new STIGs requires no changes to the core
  • Flexible filtering — filter by module, Terraform resource address (glob patterns), vulnerability ID, STIG ID, or severity level
  • Multiple output formats — text (with color), JSON, JUnit XML, or multiple formats at once
  • STIG Viewer export — generate .cklb checklist files compatible with DISA STIG Viewer 3.x
  • CI test report export — generate JUnit XML for GitLab and GitHub test report UIs
  • Manual control overlays — apply reviewer-supplied statuses and comments after automated checks
  • Failure gating — fail only on selected severity thresholds while exempting justified controls
  • Config files — load CLI defaults from .stig-check-config, .stig-check-config.yaml, or .stig-check-config.yml
  • Blank CSP-inherited output — generate no-plan checklists containing only controls inherited from the cloud provider
  • Zero runtime dependencies — stdlib only

Available Modules

Module STIG Terraform Resource Type Controls
aks DISA STIG for Kubernetes, V2R6 azurerm_kubernetes_cluster 92
azure_sql_database Microsoft Azure SQL Database STIG, V2R4 azurerm_mssql_server 76
azure_sql_managed_instance Microsoft Azure SQL Managed Instance STIG, V1R1 azurerm_mssql_managed_instance 84
documentdb MongoDB Enterprise Advanced 8.x STIG, V1R1 aws_docdb_cluster 55
eks DISA STIG for Kubernetes, V2R6 aws_eks_cluster 92
mysql_flexible Oracle MySQL 8.0 STIG, V2R3 azurerm_mysql_flexible_server 17
postgres_flexible Crunchy Data Postgres 16 STIG, V1R3 azurerm_postgresql_flexible_server 111
rds_mysql Oracle MySQL 8.0 STIG, V2R3 aws_db_instance / aws_rds_cluster (engine = MySQL) 17
rds_postgres Crunchy Data Postgres 16 STIG, V1R3 aws_db_instance / aws_rds_cluster (engine = PostgreSQL) 111

Database provider value notes

Database modules use the parameter names and enum values documented by each CSP. For example, Azure MySQL Flexible Server audit_log_events expects Azure event classes such as CONNECTION, CONNECTION_V2, DCL, DDL, and GENERAL, while Amazon RDS for MySQL server_audit_events uses MariaDB Audit Plugin values such as CONNECT, QUERY, QUERY_DCL, and QUERY_DDL. Amazon DocumentDB is checked against the MongoDB Enterprise Advanced 8.x STIG, using DocumentDB parameter values such as tls (enabled, tls1.2+, tls1.3+, fips-140-3) and audit_logs (all, enabled, or ddl,dml_read,dml_write). Check results include CSP documentation, Terraform provider documentation, and upstream RDBMS references where the provider setting maps to MySQL, MariaDB, PostgreSQL, pgAudit, or MongoDB behavior.

Installation

pip install iac-stig-automator

Release images are published as kchason/iac-stig-automator. The image entrypoint is stig-check. See CI integration for GitHub Actions and GitLab examples.

From a checkout of this repository:

pip install .

# For development (editable install with test dependencies)
pip install -e ".[dev]"

This installs the stig-check command.

Usage

Generate a Terraform plan JSON

terraform plan -out=tfplan
terraform show -json tfplan > plan.json

Auto-detect and evaluate all resources

stig-check plan.json

Specify a module

stig-check plan.json -m aks
stig-check plan.json -m eks
stig-check plan.json -m mysql_flexible
stig-check plan.json -m postgres_flexible
stig-check plan.json -m rds_mysql
stig-check plan.json -m rds_postgres
stig-check plan.json -m documentdb
stig-check plan.json -m azure_sql_database
stig-check plan.json -m azure_sql_managed_instance

Filter by Terraform resource address

# Glob patterns supported
stig-check plan.json -r "module.prod.*"
stig-check plan.json -r "azurerm_kubernetes_cluster.my_cluster"

Filter by vulnerability or STIG ID

stig-check plan.json --vuln-id V-242381
stig-check plan.json --stig-id CNTR-K8-000370

Filter by minimum severity

# CAT_I only (high)
stig-check plan.json --severity CAT_I

# CAT_I + CAT_II (high + medium)
stig-check plan.json --severity CAT_II

Failure gating and config files

By default, stig-check exits with code 1 for any non-exempt unmet control, which is equivalent to --fail-on CAT_III. Use --fail-on to gate only on CAT I, CAT II-or-higher, or CAT III-or-higher findings. Accepted values include CAT_I, CAT_II, CAT_III, CAT I, CAT II, CAT III, 1, 2, and 3.

# Report all evaluated controls, but exit 1 only for CAT I findings
stig-check plan.json --fail-on CAT_I

# Exempt a justified control from failure gating
stig-check plan.json --allowed-to-fail V-242382

Configuration is loaded from the first file found in the current directory: .stig-check-config, .stig-check-config.yaml, or .stig-check-config.yml. Use --config-file path/to/file.yml to choose a different file. CLI arguments override config file values.

module: aks
resource:
  - azurerm_kubernetes_cluster.prod
output: [text, cklb]
output-dir: ./results
fail-on: CAT_II
allowed-to-fail:
  - V-242382
  - CNTR-K8-000270
no-color: true

Config keys mirror CLI option names without leading dashes. Repeatable CLI options may be written as a single string or a list.

Output formats

Multiple formats can be specified at once. text prints to stdout; json and cklb write one file per resource to --output-dir; junit writes a single junit.xml file.

stig-check plan.json                        # default: text to stdout
stig-check plan.json -o json                # one .json per resource
stig-check plan.json -o cklb                # one .cklb per resource (STIG Viewer 3.x)
stig-check plan.json -o junit               # one junit.xml for CI test reports
stig-check plan.json --junit                # also write junit.xml with the selected formats
stig-check plan.json -o text json cklb      # text, JSON, and CKLB at once
stig-check plan.json -o json --output-dir ./results   # write to a specific directory
stig-check plan.json --no-color             # text without ANSI codes
stig-check plan.json --recommendations      # include Terraform remediation guidance

The json output writes a structured report per resource with summary and per-control details.

The cklb output writes a JSON file per resource compatible with DISA STIG Viewer 3.x. Each control is mapped to a rule with status not_a_finding, open, or not_applicable, plus viewer context fields such as group ID, rule ID, STIG ID, discussion, check content, and fix text. Use --recommendations to include recommended corrective action and Terraform resource properties/keys in text output and CKLB comments for open findings.

The junit output writes one JUnit XML file named junit.xml. Each evaluated control is a testcase: not_a_finding and not_applicable controls pass, while open controls fail.

# Specify a hostname for the cklb checklist target
stig-check plan.json -o cklb --host-name prod-aks-cluster

Manual control overlays

Use --manual-controls to apply reviewer-supplied statuses and comments after automated checks. The file can be a JSON list, or an object with a controls list. Each entry must include Control ID, Status, and Comments; Details is optional and fills checklist Finding Details when populated. Control ID may match either the vulnerability ID or STIG ID, and Status must be Not a Finding, Open, or Not Applicable.

[
  {
    "Control ID": "V-242381",
    "Status": "Not a Finding",
    "Comments": "Reviewed workload evidence manually.",
    "Details": "Manual evidence confirms the setting is enforced at runtime."
  }
]
stig-check plan.json -o cklb --manual-controls manual-controls.json

Invalid statuses and unmatched control IDs are skipped with warnings on stderr.

AKS checklist context is stored as raw JSON in src/stig_automator/modules/stigs/kubernetes_metadata.json. When DISA publishes a new Kubernetes STIG, update that JSON export from the XCCDF source so generated .cklb files include current titles, discussions, check text, fix text, CCIs, and source rule IDs.

Blank CSP-inherited output

Use --blank to generate output without a Terraform plan file. Blank output includes only controls marked as inherited from the cloud service provider, so resource filters are not supported. If -m is omitted, all modules with CSP-inherited controls are used.

stig-check --blank -m aks
stig-check --blank -m aks -o cklb --output-dir ./results

Verbose mode

# Show descriptions for all controls, not just failing ones
stig-check plan.json -v

List available modules

stig-check --list-modules

Exit Codes

Code Meaning
0 All evaluated controls are met
1 One or more non-exempt controls match the active failure threshold
2 Usage error, file not found, or JSON parse error

Adding a New STIG Module

Add raw STIG controls under src/stig_automator/modules/stigs/ and editable behavior and evidence mappings under src/stig_automator/modules/mappings/. Implement Terraform validation callbacks in a module file under src/stig_automator/modules/, subclass BaseStigModule, and decorate the class with @register.

Use automatic_platform_text for inherited or platform controls and validation_function_name for Terraform evaluation callbacks. No central registry file needs editing; modules are auto-imported.

See CONTRIBUTING.md and docs/mapping_schema.md for the field schema, import workflow, and test expectations.

Running Tests

pip install -e ".[dev]"
pytest

Project Structure

src/stig_automator/
├── cli.py              # CLI entry point (stig-check command)
├── models.py           # Severity, StigControl, CheckResult
├── plan_parser.py      # Terraform plan JSON parsing
├── output.py           # Text, JSON, JUnit, and cklb output renderers
├── util.py             # Safe nested dict/list navigation helpers
├── registry.py         # Module registry and auto-detection
└── modules/
    ├── _base.py            # BaseStigModule abstract base class
    ├── aks.py              # AKS Kubernetes STIG (92 controls)
    ├── azure_sql_database.py # Azure SQL Database STIG (76 controls)
    ├── azure_sql_managed_instance.py # Azure SQL Managed Instance STIG (84 controls)
    ├── documentdb.py       # Amazon DocumentDB STIG (55 controls)
    ├── mappings/           # Editable behavior/evidence mappings
    ├── stigs/              # Raw STIG metadata exports used by cklb output
    ├── eks.py              # Amazon EKS Kubernetes STIG (92 controls)
    ├── mysql_flexible.py   # MySQL Flexible Server STIG (17 controls)
    ├── postgres_flexible.py # Azure PostgreSQL Flexible Server STIG (111 controls)
    ├── rds_mysql.py        # Amazon RDS MySQL STIG (17 controls)
    └── rds_postgres.py     # Amazon RDS PostgreSQL STIG (111 controls)

License

STIG Automator is released under the MIT License. Read NOTICE, DISCLAIMER, SECURITY, CONTRIBUTING, and the changelog before relying on a result.

Metadata

Release files for iac-stig-automator 0.4.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for iac-stig-automator 0.4.0
File Size Uploaded Provenance Actions
iac_stig_automator-0.4.0.tar.gz 368.6 kB With provenance Details for iac_stig_automator-0.4.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for iac-stig-automator 0.4.0
File Interpreter ABI Platform Actions
iac_stig_automator-0.4.0-py3-none-any.whl Python 3 none any Details for iac_stig_automator-0.4.0-py3-none-any.whl

Total release size: 764.4 kB

Release files / iac_stig_automator-0.4.0.tar.gz

Download URL iac_stig_automator-0.4.0.tar.gz
Size 368.6 kB
Tags Source
SHA-256 checksum
How to use checksums
f538b8a89e678fdd8b0564efec68b7842fa2237a24f2f079e92109bfd22ddb43
BLAKE2b-256 checksum
How to use checksums
39c3281e28cd33658e9d5babe974fc56a92eb4d5ce01d1b7127c9f6205c0bed4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Release files / iac_stig_automator-0.4.0-py3-none-any.whl

Download URL iac_stig_automator-0.4.0-py3-none-any.whl
Size 395.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f8067c23e467b438341aa6a22298749ab1cd50a77d00fedc25f94ccf199b7dcf
BLAKE2b-256 checksum
How to use checksums
190024e798915e4ca4980fac6776f12306cf513a497553d1481869103fb41aa0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

Security for iac-stig-automator 0.4.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for iac_stig_automator-0.4.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 20, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page