Skip to content

Lab 3: partial-import recovery, forward-looking commit note, state-lock aside - #3

Merged
ajy0127 merged 1 commit into
GRCEngClub:mainfrom
abdie-grcengineer:feedback/lab-3-foundation
Sep 16, 2026
Merged

ajy0127 merged 1 commit into
GRCEngClub:mainfrom
abdie-grcengineer:feedback/lab-3-foundation

Conversation

@abdie-grcengineer

Copy link
Copy Markdown
Contributor

Documentation fixes for Lab 3 (labs/03-foundation), all found while running the lab end to end on a fresh free subscription. Two core fixes, one optional polish, plus one open question for you.

1. Step 2 — partial/missing imports surface as whack-a-mole (core)

If any of the four terraform import commands doesn't land (an interrupted run, a skipped line), a later terraform apply fails with ... already exists - to be managed via Terraform this resource needs to be imported into the State — but only for the independent resources first, and the dependents (mg-grc-sandbox needs mg-grc; the workspace needs the RG) after those are fixed. So you fix two, re-apply, and get two more. It reads like the lab is broken.

Fix: added a note after the import block telling students to run terraform state list up front and re-import everything still missing in one pass, instead of reacting to errors one wave at a time.

2. Verify section — "Committed and pushed" contradicts the steps (core)

## Verify, 4th item:
- [ ] Committed and pushed — from here on: changes go through the repo, never the portal

Following Steps 1–4 exactly (bootstrap.sh, import the four existing resources, terraform apply, deny test), nothing edits a tracked file. The stage Terraform ships in the starter — you apply it, you don't write it — and backend.hcl + the evidence JSON are gitignored. So git status is clean and there is literally nothing to commit. A student following the instructions cannot truthfully check that box.

Fix: reworded the item as a forward-looking workflow principle, and noted that committable work actually begins in Lab 4.

3. Step 2 — stuck Acquiring state lock… (optional polish)

An interrupted run leaves a lease on the state blob, and the next plan/apply hangs on Acquiring state lock forever. Added a short aside: take the lock ID from the error and terraform force-unlock <ID>, or break the blob lease. Drop this hunk if you consider it too generic-Terraform for the lab.

Open question — Step 4 "Save the error JSON" (no change made)

Step 4 says: "Read the full error ... Save the error JSON — it's a preventive-control evidence artifact." But az doesn't return clean JSON on a policy deny — it prints a text error with an embedded Policy identifiers: [...] array. So "save the error JSON" doesn't map to a real command as written, and I didn't want to guess your intent with a file change.

Which did you mean? (a) save the raw error text (... 2> lab3-deny-evidence.txt), (b) extract just the policy-identifiers JSON, or (c) pull the structured denial record from somewhere else (e.g., the Activity Log)? Whichever it is, the step should include the exact command — happy to add it once you confirm.

Scope

  • One file changed: labs/03-foundation/README.md.
  • No script or command behavior changed — documentation only.

🤖 Generated with Claude Code

…note, state-lock aside

Documentation fixes for labs/03-foundation, found while running the lab end to end.

1. Step 2 - partial/missing imports surface as whack-a-mole. If any of the four
   imports does not land (interrupted run, skipped line), a later apply fails with
   "already exists - needs to be imported", but only for independent resources first
   and dependents after those are fixed. Added a note telling students to run
   `terraform state list` up front and re-import everything missing in one pass,
   rather than reacting to errors one wave at a time.

2. Verify section, "Committed and pushed" item - contradicted the steps above it.
   Labs 1-3 only import and apply the provided starter; nothing edits a tracked file,
   so `git status` is clean and there is nothing to commit. Reworded the item as a
   forward-looking workflow principle and noted that committable work begins in Lab 4.

3. (Optional) Step 2 - added a short aside for a run that hangs on
   "Acquiring state lock": a stale lock from an interrupted run; force-unlock or
   break the blob lease.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@qodo-code-review

Copy link
Copy Markdown

ⓘ Qodo reviews are paused because the subscription is no longer active. Ask your workspace admin to reactivate the subscription to resume reviews. Manage billing

@coderabbitai

coderabbitai Bot commented Sep 14, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 7d411664-5c15-4740-86fb-dd2aac95eac4


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ajy0127
ajy0127 merged commit 1f75cc4 into GRCEngClub:main Sep 16, 2026
4 checks passed
ajy0127 added a commit that referenced this pull request Sep 16, 2026
- Lab 3: answer the open question from PR #3 — the deny test now tees its
  output to lab3-deny-evidence.txt and the text says the raw error (with the
  Policy identifiers block) is the artifact, not JSON
- Lab 5: derive TF_VAR_state_storage_account from backend.hcl (same fix
  PR #4 made in Lab 4 — the placeholder produced a cryptic 'no such host')
- Lab 2: note the one-time log-analytics CLI extension prompt (query block
  verified live against law-grc-sandbox)
- VALIDATION-LOG: F16-F19 recording all four runthrough findings; stage 03
  rename verified as a no-op plan against the live environment on azurerm 4.81

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants