3 — Run checks
Step 3 — Run checks
Run these from the repository root (where the Makefile lives).
1. No registry token required
These use only the files in your clone:
make fmt-check # Terraform formatting (must match CI)
make opa-fmt-check # Rego formatting (needs opa on PATH)
make opa-check # Rego parse / check per policy file (needs opa)
If opa is not installed, skip the opa-* targets until you need them.
To auto-fix Terraform format:
make fmt
2. Terraform validate (optional here)
make validate runs tofu init and tofu validate in each module and example when OpenTofu is installed; otherwise it uses terraform (same flags). That requires:
- Network access to download providers.
Set the environment variable (works for OpenTofu and Terraform):
export TF_TOKEN_releases_stackgen_com="<your-token>"
make validate
Details and alternatives (for example ~/.terraformrc / OpenTofu CLI config) are in the repository README — Local verification.
3. One-shot “like CI”
make check
This runs format checks, OPA checks, and validate. If validate fails on provider download, configure registry credentials as in the README.
4. Clean up after experiments
make clean
Removes .terraform directories under modules/ and examples/ from local init runs.
Next: Step 4 — Use a module
Previous: Step 2 — Your machine