Skip to main content

LaGuardia - Lightweight Policy-as-Code for Terraform/OpenTofu

Project description

LaGuardia - Lightweight Policy‑as‑Code

Guardrails for Terraform/OpenTofu plan JSON with simple YAML rules and Auto‑Fix.

LaguradiaLogo

Install

pip install ./laguardia

Dev (editable) install for local changes:

python3 -m venv .venv && source .venv/bin/activate
python -m pip install -U pip
pip install -e .

Usage

terraform init
terraform plan -out plan.out
terraform show -json plan.out > plan.json

laguardia scan --plan plan.json --rules examples/rules.yaml --out report.html --autofix fixes.json
# Exit code 1 if any 'error' findings

Alternative (one-liner) to produce plan.json:

terraform plan -out=plan.out && terraform show -json plan.out > plan.json && rm -f plan.out

Output semantics:

  • Findings print as [ERROR|WARNING] <rule> <type>.<name>: <message>
  • Final line prints Run status: OK or Run status: FAIL
  • Control failing behavior via --fail-on [error|warning|none] (default: error)

Rules (YAML)

See examples/rules.yaml. Supported kinds:

  • require_tags: ensure tags/labels exist.
  • field_equals: nested field equals a value.
  • forbid_cidr: remove forbidden CIDR from list.

Docker

docker build -t laguardia .
docker run --rm -v $(pwd):/data laguardia scan --plan /data/plan.json --rules /data/examples/rules.yaml --out /data/report.html --autofix /data/fixes.json

Tests

pip install .
pip install pytest
pytest -q

🤝 Contributing

Maintained by Senora.dev - community contributions are welcome!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

laguardia-0.2.0.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

laguardia-0.2.0-py3-none-any.whl (5.5 kB view details)

Uploaded Python 3

File details

Details for the file laguardia-0.2.0.tar.gz.

File metadata

  • Download URL: laguardia-0.2.0.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for laguardia-0.2.0.tar.gz
Algorithm Hash digest
SHA256 5a420659ca3eb7166111328743cd07d5eca934cad8750676151de3754a70d0a7
MD5 0908ad6024408f6d6c5b6ca21d102831
BLAKE2b-256 2e5f4680ab09297ee97f28a11b0e43c094ec2905305e21c182d1520b8d663280

See more details on using hashes here.

Provenance

The following attestation bundles were made for laguardia-0.2.0.tar.gz:

Publisher: deploy.yml on Senora-dev/LaGuardia

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file laguardia-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: laguardia-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for laguardia-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c1922b533a0500a3d9197d41bf8ee28afbdfd4b6b995831765ce599f4a928a41
MD5 8539fadec1c89fa2b6bb549be72fe87c
BLAKE2b-256 8d8fea5c5db998f9da8e1bde4d49f48edb52ec0d2895106c0f718cbd3cde2295

See more details on using hashes here.

Provenance

The following attestation bundles were made for laguardia-0.2.0-py3-none-any.whl:

Publisher: deploy.yml on Senora-dev/LaGuardia

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page