Home/Using the templates/The three levels
The three levels
The same result at three levels of commitment. Move up when you are ready.
The levels are named Quick start, Standard, and
Hardened everywhere on this site. Only folder and file
names use the short forms: t0 is Quick start,
t1 is Standard, and t2 is
Hardened, as in outcomes/audit-log-immutable/aws/t1
and the download audit-log-immutable-aws-t1.zip.
Code that is safe to paste into a scratch account and code a team runs in production are written differently. Every result here is written up to three times so you can pick the one that matches what you are doing today.
Quick start
Someone who wants to see the thing work before deciding anything.
One file. Copy it, run it, and you have a working example in a few minutes.
Every template at this level follows these rules:
- one file, read it top to bottom
- nothing to set up before you run it
- no modules or roles to follow into
- anything you must change sits at the very top of the file
Standard
A team putting this into an account they care about.
Settings you can change, shared state, consistent tags, and your own encryption key.
Every template at this level follows these rules:
- settings live in their own file, separate from the logic
- shared state or a shared source of truth, with a filled-in example
- every resource carries the four standard tags, where the target has tags
- uses your own encryption key wherever the platform offers one
Hardened
Anyone who has to show an auditor that the setting stayed put.
Rules that block a bad change before it applies, plus a job that tells you when someone edits it by hand.
Every template at this level follows these rules:
- Standard, unchanged, used as a module, so there is one copy of the logic
- policy rules in policy/ that fail the plan, each with tests
- a scheduled job that compares the live account to the code and opens an issue when they differ
- security scan set to fail, and any exception written down with a reason
Moving between levels
Treat each level as its own thing. The names and settings differ between them, so applying Standard on top of a quick start creates a second set of resources beside the first.
The quick starts are built to be removed. The AWS and Azure audit log versions lock for one day, so you can try them today and clear them out tomorrow. When you are ready to keep something, remove the quick start and apply Standard.
Hardened uses Standard as a module, so every resource address gains a
module.standard. prefix. To move a Standard you have already applied,
run terraform state mv for each resource, or apply Hardened fresh and
retire Standard.
Setting up a Hardened Terraform folder
- Keep
t1besidet2. Hardened calls it withsource = "../t1". - Put your settings in
terraform.tfvarsinsidet2, and fill in the backend block inversions.tfso every plan reads the real state. - Copy
guard.ymlinto.github/workflows/. Give it a read-only identity through the repository variables it names. That is an AWS role, a Google service account through workload identity federation, an Azure app with a federated credential, or an OCI API key. - On each pull request it runs the security scan, a plan, and the rules in
policy/. Every day it plans again, and opens an issue if the live account no longer matches the code.
Run the rules yourself before a pull request:
terraform plan -out plan.out
terraform show -json plan.out > plan.json
opa eval --fail-defined --format pretty -d policy -i plan.json 'data.iac.deny[msg]'
Nothing printed means every rule passed. Each rule has tests beside it:
opa test policy.
Hardened Ansible and Argo CD folders
An Ansible Hardened folder runs Standard's roles unchanged, found through its
ansible.cfg, with your values in settings.yml. The
rules in policy/ check that file before anything runs:
opa eval --fail-defined --format pretty -d policy -i settings.yml 'data.iac.deny[msg]'
Its guard.yml runs ansible-lint on the production profile, the
rules, and a syntax check on each pull request, and a daily
--check run that opens an issue when a machine has drifted. Commit
inventory.ini beside site.yml, and give the workflow an
SSH key, or a WinRM password for Windows, as a secret.
An Argo CD Hardened folder builds from Standard's manifests. The rules read
every manifest under ../t1, collected by
tools/manifests.py, and CI runs them against Standard as it is.
The daily job runs kubectl diff against the cluster with a
kubeconfig from a secret.