Generate, Verify, Trust (MIDTERM)
Apologetic question: "What work is rightly given to the servant, and what must the master keep?"
Project 8 — Generate, Verify, Trust (MIDTERM)
“The simple believes everything, but the prudent gives thought to his steps.” — Proverbs 14:15 (ESV)
Chapter: 8 — Infrastructure as Code, and the Limits of the Servant
Due: End of Week 8 — this is the course MIDTERM
Format: A 60-minute, live, in-session build. Closed-AI. Closed-internet. Open-textbook. No coding agent, no copilot, no web search, no LLM of any kind. You may use this book (every chapter), your own notes, and man/--help pages on your machine. A proctor (or your honor-pledged submission log) confirms the conditions.
Submit: A link to a public GitHub repo containing webserver_fixed.yml, storage_fixed.tf, your CI workflow (Medium), and REPORT.docx (Hard memo + the trust write-up). Real toolchain, real git — see Appendix A.
Allowed tools: Linux/VM with ansible + ansible-lint, terraform/tofu + tflint (and tfsec/checkov if installed), PyYAML, a real editor, git, and the textbook. AI policy: OFF. Phase 1 (weeks 1–8) is AI-off for the building. The whole point of the midterm is to prove you can do the servant’s work yourself — so that in Phase 2 you have earned the right to direct the servant. (Phase 2, weeks 9–16, turns agentic AI on and requires an agent-log.txt. Not this week.)
Before the exam (pre-install + pre-cache) — do this the night before, while you still have the network. The clock is closed-internet, and several of these tools reach for the network the first time you run them. If you wait until the exam, you’ll burn your 60 minutes watching downloads fail. Get all of this on your machine and warm before the closed-internet clock starts:
- Install the toolchain:
ansible+ansible-lint,terraform(ortofu) +tflint, andPyYAML(plustfsec/checkov/gitleaksif you’ll attempt Medium). Exact install commands are in the midterm Coach’s Note in Appendix A §A.11 (The Course Toolkit).- Pre-cache the Ansible collection: run
ansible-galaxy collection install community.generalonce, online. The fixed playbook usescommunity.general.ufw, and that install will not work once the internet is cut.- Pre-cache the Terraform provider: in the chapter’s
code/folder, runterraform init -backend=falseonce, online. This downloads thehashicorp/awsprovider into.terraform/sovalidate/tflint/planwork offline. (-backend=falsemeans no remote state and no AWS account or credentials are touched — see below.) Confirmterraform validateruns clean before the exam; if it can’t find the provider during the exam, you didn’t pre-cache.The same closed-internet pre-cache discipline is spelled out in Appendix A §A.11. No real AWS account is needed for this exam — every Terraform step below is credential-free (validate /
-backend=false/ a no-refresh plan). If a step ever prompts you for AWS keys, you’re running the wrong command.
Cumulative Midterm Review — Weeks 1–7
The midterm assumes all seven prior weeks live in your hands, not just IaC. The artifacts you’ll fix touch users, packages, services, storage, network rules, and deployment — so review why each defect is dangerous, in the vocabulary of the weeks that taught it.
| Wk | Chapter | The idea the midterm leans on | A question to be able to answer cold |
|---|---|---|---|
| 1 | The Administrator in the Age of AI | AI as fast/confident/sometimes-wrong partner; human-in-the-loop; right-tool tiering (Haiku/Sonnet/Opus). | Why does an AI’s confidence tell you nothing about its correctness? |
| 2 | Operating System Architecture | processes, services, init/systemd, file permissions, local model serving basics. | What does mode: "0644" mean, and why is 0777 on a config a finding? |
| 3 | Identity & Access | least privilege, accounts, secrets, no plaintext credentials; deepfakes defeat “I recognized it.” | Why is a plaintext password: in a playbook a Ch. 3 failure, not just a Ch. 8 one? |
| 4 | Storage Administration | filesystems, object storage, encryption-at-rest, retention, data governance. | Why are a public acl and missing encryption on a backup bucket worse than on a temp bucket? |
| 5 | Network Services | ports, firewalls, exposure, 0.0.0.0/0 vs scoped CIDRs, TLS. | Why is opening port 22 to 0.0.0.0/0 categorically different from opening 443 to it? |
| 6 | Virtualization | declarative resource definition, isolation, reproducible environments. | How is a Terraform resource block like declaring a VM’s desired shape? |
| 7 | Containers & Deployment | images as artifacts, reproducibility, shipping a unit whole, OCI. | Why does “the file is the source of truth” echo “the image is the source of truth”? |
The five-minute warm-up (do before the clock starts): read code/webserver.yml and code/storage.tf once, end to end, the way you read a PR. Don’t fix anything yet — just locate, in your head, every line that touches a user, a secret, a port, an ACL, an order, or a non-existent name. Those are your six review lenses, and each one is a prior week paying off.
The Setup
The diocese’s small ops team has started using an AI coding agent to draft infrastructure changes. It is genuinely faster. It is also, twice now, almost shipped something dangerous — a backup bucket readable by the world, a firewall rule opening SSH to everyone — and both times a human caught it in review just barely. The lead has made a rule, and you are being tested on whether you can be the human who enforces it: AI proposes, CI validates, the human gates.
This morning the agent produced two artifacts for the new chapel web tier — an Ansible playbook (code/webserver.yml) and a Terraform snippet for the backup bucket (code/storage.tf). They lint mostly clean. They look production-ready. They are not. Your job, in 60 minutes, with no AI to lean on, is to generate the corrected versions, verify them through the funnel, and trust them — in writing — well enough to apply.
This is the exact judgment you’ll exercise for every agent-authored PR in Phase 2. You’re proving you can do it by hand now so you can govern it at scale later.
Setup (the starter)
Clone this chapter’s code/ folder. The defective artifacts are code/webserver.yml and code/storage.tf; the validation gate is code/verify_iac.sh; the human-gate is code/approval_gate.py. Each defective file’s header comment names the classes of defect seeded in it (not the line numbers — finding those is the test).
Learning Targets
By completing this midterm, you will demonstrate that you can:
- Verify AI-generated IaC by eye and through a deterministic funnel — finding hallucinated modules/arguments, insecure defaults, plaintext secrets, and non-idempotent/wrong-order steps.
- Correct the defects into idempotent, least-privilege, secure IaC that lints clean and dry-runs clean on a second pass.
- (Medium) Build a CI pipeline that blocks defective IaC and a human-gated apply step that logs every decision.
- (Hard) Decide, in writing, which work to delegate to an AI agent and which a human must keep — mapped to LLM05, LLM06, the lethal trifecta, and the Rule of Two.
- Recall and apply the Weeks 1–7 foundations that make each defect dangerous.
Normal Tier
Goal: Find, name, and fix every seeded defect in both artifacts, producing webserver_fixed.yml and storage_fixed.tf that pass the validation funnel and are idempotent and secure.
Required features
- A defect ledger in
REPORT.docx: for each defect, the file + line, its class (hallucinated module/argument · insecure default · plaintext secret · non-idempotent/wrong-order), and the prior week it maps to (e.g. plaintext secret → Ch. 3). webserver_fixed.yml— the Ansible playbook corrected: the hallucinated module replaced with the realcommunity.general.ufw; SSH scoped (not0.0.0.0/0); the plaintext password removed (variable/vault placeholder); the service started after the config; every task idempotent (no bareshell:withoutcreates:/changed_when:). It must passansible-lintclean and report a clean--check --diffsecond pass (allok, zerochanged).storage_fixed.tf— the Terraform corrected: the hallucinatedauto_tieringargument removed; thepublic-readACL made private; encryption-at-rest and versioning added; the region made a variable. It must passterraform validateandtflintclean and would pass a “no public buckets, encryption required” policy.- Proof: paste the before (failing) and after (passing) output of
code/verify_iac.shintoREPORT.docx.
Normal-tier rubric (out of 100)
| Criterion | Points |
|---|---|
| Defect ledger complete and correctly classified (all 4 classes found in both files) | 25 |
webserver_fixed.yml correct, idempotent (clean second --check), passes ansible-lint | 25 |
storage_fixed.tf correct, secure, passes terraform validate + tflint | 25 |
| Each defect mapped to the prior week / control it violates | 10 |
| Before/after verifier output included; repo clean, README present | 15 |
| Total | 100 |
Medium Tier (+up to 25% extra credit)
Goal: Turn “I fixed it” into “the pipeline won’t let a defect through.”
.github/workflows/iac.yml(or aMakefile) that runs the full funnel on every push:terraform init -backend=false+fmt -check+validate,tflint, a policy/secret scan (tfsec/checkov/gitleaksor the chapter’s grep),ansible-lint, and a credential-freeterraform plan -refresh=false(no real AWS account, no live state — the seeded defects are all visible from the config alone, so the plan never needs to talk to AWS). The job must fail on any seeded defect — prove it by committing a defective file on a branch and showing the red run, then the green run after the fix.- A human-gated apply using
code/approval_gate.py: pipe it a destructive plan and show it holds for a human and that the decision is appended toaudit.log. Include the log excerpt. - In
REPORT.docx, one paragraph: which funnel stage caught which defect, and which defect class no linter could catch (and why a human is therefore irreplaceable).
Hard Tier (+up to 25% additional extra credit)
Goal: The judgment an agent cannot make for you. This is the heart of the midterm and the bridge into Phase 2.
Write REPORT.docx’s memo (≤ 1.5 pages): Going into Phase 2, which of this week’s tasks would you responsibly delegate to an AI agent, and which must a human keep — and why? Required moves:
- Split the work into delegate-to-servant (generate the first draft, reformat, draft the runbook, run the linters) vs keep-for-master (approve the
apply, decide the policy, read the destroy plan, hold the credential), and justify the line. - Map your reasoning to LLM05 (Improper Output Handling) and LLM06 (Excessive Agency), the lethal trifecta, and Meta’s Rule of Two — name the specific capability you’d remove from the agent to make an otherwise-unsafe task safe.
- State the least-privilege scope you’d grant an IaC agent in Phase 2 (branches, cloud role, who holds the
applycredential, what gets audit-logged) and defend it. - Close with the one-sentence rule you will personally operate by when an agent hands you a config. Make it yours.
A memo that just says “always review everything” earns little. A memo that draws the line — defensibly, with the framework names doing real work — earns it all.
Submission
Public GitHub repo containing: webserver_fixed.yml, storage_fixed.tf, REPORT.docx (defect ledger + Medium notes + Hard memo), the CI workflow (Medium), audit.log excerpt (Medium), and README.txt with run instructions. Tag the commit midterm-p8. Include your honor pledge confirming the closed-AI, closed-internet conditions.
Hints (Read Before You Begin)
- Warm up with your eyes, not the linter. Read both files end to end first (the six lenses above). Linters catch the broken; you catch the wrong. Find the policy violations (open port, public ACL) by judgment before any tool runs.
- The hallucinated names are the trap.
community.general.ufw_ruleand Terraform’sauto_tieringlook real. When a name feels plausible but you can’t place it, that’s the snag the IaC Validation Sandbox trained — confirm withansible-lint/terraform validate, never accept it. - Prove idempotency on the second run. A clean first apply means nothing; a clean
--check/plansecond pass (allok, “No changes”) is the proof. - Don’t over-fix. Changing correct lines to look “more secure” without reason is the cry-wolf failure. Fix defects; leave the rest.
- Budget the clock: ~15 min verify, ~25 min correct + prove, ~20 min the trust write-up / memo. The memo is where the points (and the judgment) are.
What Mastery Looks Like (Beyond the Rubric)
A passing midterm finds the four defects. A masterful one reads like the work of someone who would be trusted to gate every agent PR in the building: the defect ledger names not just the bug but the control it violates and the week that taught it; the fixes are minimal and idempotent, not anxious over-corrections; and the memo draws a line you could defend to a skeptical lead — here is what the servant does, here is what I keep, and here is the exact privilege I’d remove to sleep at night. That last document is the whole course in one page.
Coach’s Note — Sixty minutes, no AI, is not cruelty — it’s the only honest test of whether you can do the thing you’ll soon be asking an agent to do. You can’t gate what you can’t do. After this week, the AI comes back on and stays on. Earn it here.
When You’re Done
- Both artifacts fixed;
verify_iac.shprintsPASSon the fixed versions,BLOCKEDon the originals. - Defect ledger complete, classified, and mapped to prior weeks.
- Idempotency proven on a clean second
--check/plan. - (Medium) CI fails on a defect, passes after fix; apply is human-gated and logged.
- (Hard) The delegate-vs-keep memo names LLM05/LLM06, the lethal trifecta, and the Rule of Two — and draws a real line.
- Honor pledge included; commit tagged
midterm-p8.
A theological footnote. The midterm asks you to be the prudent one in the household — to receive the servant’s labor gladly and still give thought to your steps (Prov. 14:15). The faithful servant in Luke 17:10 does all that is commanded and claims no authority for it; the authority, and the accountability, stay with the master. That is exactly the line you draw in the Hard memo: the servant generates, validates, drafts, and never tires — and you keep the judgment, the verification, and the answer to “who approved this.” Closed-AI for sixty minutes is the discipline that lets you keep it well. Do the duty; keep the keeping.
See you next week.