CLICommands
l4 diff
l4 diff shows the cost delta between your current Terraform state and a baseline. By default the baseline is the git merge-base (main or master); you can also point it at a saved snapshot file.
l4 diff main.tf
l4 diff ./infra/
l4 diff --base main ./infra/
l4 diff baseline.json ./infra/Flags
| Flag | Description |
|---|---|
--base <ref> | Git ref to diff against (default: auto-detect main or master) |
--region <r> | AWS region for pricing (default us-east-1) |
--gcp-region <r> | GCP region (default: auto-detect or us-central1) |
--azure-region <r> | Azure region (default: auto-detect or eastus) |
--var <key=value> | Terraform variable (repeatable) |
--var-file <path> | Terraform variable file (repeatable) |
--download-modules | Download remote modules for accurate estimates (default true) |
--fail-above <amount> | Exit code 2 if monthly delta exceeds this threshold |
--format | table, json, or github-comment (default table) |
CI gate
Fail the build when a PR adds more than $100/month:
l4 diff --fail-above 100 -q ./infra/The exit code is 2 (ExitIssuesFound) when the threshold is exceeded — distinguishable from generic failures (1).
Comparing against a saved baseline
Useful for non-git workflows or for staging a multi-step deployment:
l4 estimate --out-file baseline.json ./infra/
# … make changes …
l4 diff baseline.json ./infra/github-comment format
Drop the diff straight into a PR comment:
l4 diff --base main --format github-comment ./infra/ \
| gh pr comment "$PR_NUMBER" --body-file -Related
l4 estimate— absolute monthly-cost estimate- GitHub Actions guide — wire
l4 diffinto PR checks - CI/CD guide — patterns for GitLab, CircleCI, Jenkins