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.
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: OKorRun 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a420659ca3eb7166111328743cd07d5eca934cad8750676151de3754a70d0a7
|
|
| MD5 |
0908ad6024408f6d6c5b6ca21d102831
|
|
| BLAKE2b-256 |
2e5f4680ab09297ee97f28a11b0e43c094ec2905305e21c182d1520b8d663280
|
Provenance
The following attestation bundles were made for laguardia-0.2.0.tar.gz:
Publisher:
deploy.yml on Senora-dev/LaGuardia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
laguardia-0.2.0.tar.gz -
Subject digest:
5a420659ca3eb7166111328743cd07d5eca934cad8750676151de3754a70d0a7 - Sigstore transparency entry: 570258187
- Sigstore integration time:
-
Permalink:
Senora-dev/LaGuardia@e9c2dcefbaeac993f131ca4c0677fa7a03b9137b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Senora-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@e9c2dcefbaeac993f131ca4c0677fa7a03b9137b -
Trigger Event:
push
-
Statement type:
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1922b533a0500a3d9197d41bf8ee28afbdfd4b6b995831765ce599f4a928a41
|
|
| MD5 |
8539fadec1c89fa2b6bb549be72fe87c
|
|
| BLAKE2b-256 |
8d8fea5c5db998f9da8e1bde4d49f48edb52ec0d2895106c0f718cbd3cde2295
|
Provenance
The following attestation bundles were made for laguardia-0.2.0-py3-none-any.whl:
Publisher:
deploy.yml on Senora-dev/LaGuardia
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
laguardia-0.2.0-py3-none-any.whl -
Subject digest:
c1922b533a0500a3d9197d41bf8ee28afbdfd4b6b995831765ce599f4a928a41 - Sigstore transparency entry: 570258192
- Sigstore integration time:
-
Permalink:
Senora-dev/LaGuardia@e9c2dcefbaeac993f131ca4c0677fa7a03b9137b -
Branch / Tag:
refs/tags/v1.0.0 - Owner: https://github.com/Senora-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
deploy.yml@e9c2dcefbaeac993f131ca4c0677fa7a03b9137b -
Trigger Event:
push
-
Statement type: