Skip to content

CLI Usage

Huzefaaa2 edited this page Jan 26, 2026 · 13 revisions

CLI Usage

Install

python -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"

Install from PyPI

pip install terraform-guardrail

PyPI: https://pypi.org/project/terraform-guardrail/ (latest: 1.0.4)

Scan

terraform-guardrail scan ./examples
terraform-guardrail scan ./examples --state ./examples/sample.tfstate
terraform-guardrail scan ./examples --schema
terraform-guardrail scan ./examples --policy-bundle baseline
terraform-guardrail scan ./examples --policy-bundle-path ./policies/baseline.tar.gz
terraform-guardrail scan ./examples --fail-on medium

Generate snippets

terraform-guardrail generate aws aws_s3_bucket --name demo
terraform-guardrail generate azure azurerm_storage_account --name demo

Policy registry (OPA bundles)

terraform-guardrail policy list
terraform-guardrail policy fetch baseline --destination ./policies
terraform-guardrail policy fetch baseline-signed --destination ./policies
terraform-guardrail policy init --destination ./my-bundle --bundle-name guardrail
terraform-guardrail policy validate ./my-bundle.tar.gz

Policy bundle evaluation requires the opa CLI on your PATH.

Registry API

terraform-guardrail registry-api --host 0.0.0.0 --port 8090

Clone this wiki locally