terraform-patterns

terraform-patterns is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 67 tokens per session (1,469 once invoked), scanned A, original, Apache-2.0.

A guide to organising Terraform, a tool that describes and manages cloud infrastructure in code. It covers reusable modules, shared remote state, locking, version constraints, and safer infrastructure changes.

In plain words
What is it for?
Designing Terraform modules, setting up state backends, reviewing infrastructure-as-code, deploying across regions, and standardising Terraform CI/CD.
Why use it?
It reduces configuration drift, conflicting changes, lost state, and accidental exposure of credentials. Consistent structure also makes infrastructure easier for teams to review and reuse.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Designing Terraform modules, setting up state backends, reviewing infrastructure-as-code, deploying across regions, and standardising Terraform CI/CD.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tmj-90/gaffer/terraform-patterns
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tmj-90/gaffer --skill terraform-patterns
Clone the repo
git clone --depth 1 https://github.com/tmj-90/gaffer

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for terraform-patterns

README.md
[![agentmods](https://agentmods.dev/badge/skills/tmj-90/gaffer/terraform-patterns/github.svg)](https://agentmods.dev/skills/tmj-90/gaffer/terraform-patterns)
Your own site
<a href="https://agentmods.dev/skills/tmj-90/gaffer/terraform-patterns"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/terraform-patterns/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for terraform-patterns

Your own site · 80×15
<a href="https://agentmods.dev/skills/tmj-90/gaffer/terraform-patterns"><img src="https://agentmods.dev/badge/skills/tmj-90/gaffer/terraform-patterns.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 67 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,469 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00067 $0.01469
Opus 5.5 $0.00027 $0.00588
Sonnet 5.5 $0.00013 $0.00294
Haiku 4.5 $0.00007 $0.00147

Measured 1mo ago against content hash fe11985b84b4, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

terraform-patterns scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

runner/skills/terraform-patterns/SKILL.md · 104 lines

How it starts

The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Write predictable, secure Terraform

Terraform changes real infrastructure, and its state file is a shared, lock-protected database that also holds secrets in plaintext. Follow HashiCorp's style guide and module guidance; verify with fmt and validate (the factory's safety hook refuses terraform test in an agent session, so it runs in CI or by a human); never apply from an agent session.

Layout (HashiCorp style guide)

terraform.tf   # terraform { required_version, required_providers }
providers.tf   # provider blocks — ROOT modules only
backend.tf     # backend config — root only
main.tf        # resources and data sources (split by concern when large: network.tf …)
variables.tf   # alphabetical; type, description, default?, sensitive?, validation
outputs.tf     # alphabetical; description, value, sensitive?
locals.tf
modules/<name>/  # local child modules, same layout minus providers/backend

Names are descriptive snake_case nouns without the type (aws_instance.web_api, not aws_instance.web-api-instance).

Procedure

  1. Read what exists. search_lore for backend, naming, tagging and module conventions. Read the root modules, .terraform.lock.hcl, CI jobs and any policy (tflint, checkov, trivy config). Extend the existing module style.
  2. Design the module interface. One module = one coherent concern. Every variable has type and description; optional ones have a sensible default; secrets set sensitive = true; validation blocks only for real invariants. Outputs are the minimum callers need, each with a description. Child modules declare required_providers with a minimum version (>=) and never contain provider blocks; the root pins providers (~> or exact) and commits .terraform.lock.hcl.
  3. Write resources safely.
    • for_each keyed by stable names for collections of distinct things; count only for on/off. Index-shifting count lists destroy and recreate resources.
    • Stateful resources (databases, buckets, KMS keys) get lifecycle { prevent_destroy = true }.
    • Refactors use moved blocks (and removed/import blocks) instead of manual terraform state mv, so the plan shows no destroy.
    • Least-privilege IAM (no "*" actions or resources without a written reason), encryption at rest and in transit, no public buckets, no 0.0.0.0/0 on admin ports.
    • Tags via provider default_tags where supported: environment, owner, managed-by.
  4. State and locking. Remote backend with locking and encryption; for S3 use use_lockfile = true (Terraform ≥ 1.11; DynamoDB locking is deprecated). Separate state per environment (directory or workspace), and restrict who can read state — sensitive hides values in plan output, not in state. Share data across states with data sources or terraform_remote_state outputs, not whole-state access.
  5. Respect the lock. Never pass -lock=false. Never terraform force-unlock unless you have proven the holder process is gone (not merely slow or paused) — breaking a live holder's lock is the concurrent-writer bug that lost acknowledged writes in live runs, and here it corrupts state. Use -lock-timeout=5m in CI instead.
  6. Credentials. From the environment or OIDC/dynamic credentials — never in .tf, .tfvars committed to git, or provider blocks.
  7. CI. On PR: fmt -check, validate, terraform test, security scan, and plan posted for review. Apply only from the protected default branch, one run per state at a time.
  8. Verify (below), evidence each acceptance criterion with the record-evidence skill, then stop. Do not run plan, apply or destroy: they reach the cloud with whatever ambient credentials the host holds (~/.aws, gcloud). If an AC needs a real plan, state in evidence that a human must run it, or mark_ticket_blocked.

Read the full file on GitHub · 104 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago Changed · +5 lines fe11985b84b4
  2. 2mo ago Changed · +36 lines ae0e9ba14549
  3. 2mo ago First seen · 63 lines · 67 tokens per session scan A 589cad757a18

Subscribe to this mod's changes

terraform-patterns is a skill published in the GitHub repository tmj-90/gaffer (1 stars, last pushed yesterday), licensed Apache-2.0. It adds 67 tokens to every session and 1,469 once invoked, about $0.0003 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.

Related

terraform-patterns compared with skills from other repositories

terraform-patterns next to 6 skills from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
terraform-patternstmj-90/gafferSkill1yesterdayApache-2.0A67Claude Code, Codex
bulwark-brainstormQBall-Inc/the-bulwarkSkill9yesterdayMITA50Claude Code
plan-creationQBall-Inc/the-bulwarkSkill9yesterdayMITA38Claude Code
test-auditQBall-Inc/the-bulwarkSkill9yesterdayMITA0Claude Code
anthropic-validatorQBall-Inc/the-bulwarkSkill9yesterdayMITA40Claude Code
code-reviewQBall-Inc/the-bulwarkSkill9yesterdayMITA61Claude Code
create-subagentQBall-Inc/the-bulwarkSkill9yesterdayMITA42Claude Code