← ClaudeAtlas

writing-terraformlisted

Write or change Terraform so the plan does exactly what was asked and nothing else: every argument checked against the locked provider schema, every value traced to a reference, a variable or the user, data stores hardened and protected by default, a moved block for every address change, replace-forcing changes to stateful resources stopped and raised, and the expected plan handed back. Use when creating or editing .tf, .tfvars or .tftest.hcl files: adding a resource or module, renaming a resource, switching count to for_each, fixing an AccessDenied or a validate error, or changing a database, bucket, table, queue or key.
rhawk117/cc-terraform-harness · ★ 1 · API & Backend · score 73
Install: claude install-skill rhawk117/cc-terraform-harness
# Writing Terraform The plan is the deliverable, not the HCL. Code that reads as idiomatic but plans a destroy, invents an instance size or widens IAM to `*` is worse than no code, because the reviewer reads the HCL and the apply does what the plan says. Each rule below names the review-module rubric ID it prevents, so a reviewer's finding and the rule you broke are the same thing. `references/good-vs-bad.md` pairs bad and good HCL for each rule. ## Standing rules These hold for the whole task, after the first edit as much as before it. 01. **Arguments come from the locked schema (VE7).** Before you write or change a resource or data source block, call `provider_schema` for its type, even a type you know well. An argument the schema does not list does not exist in this provider version, however familiar it looks: `aws_db_instance` takes `db_name`, not `name`. Not verified is for a lookup that failed, never for one you skipped. 02. **Never invent a value (IN9).** Every literal is one the user gave, one the repository already uses, or a documented constant. Sizing, retention, CIDRs, account IDs, AMIs, instance classes and engine versions you were not given become a variable with no default, or an open question in the hand-off. A plausible default is still an invention. 03. **Never widen IAM to clear an error (SE6).** Grant the one action the error names on the one resource it names, by reference (`aws_dynamodb_table.ledger.arn`). Never `*`, `service:*`, a `*` principal or a