terraform-patterns

terraform-patterns is a skill for Claude Code, Codex from tmj-90/gaffer. It costs 67 tokens per session (801 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 801 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.00801
Opus 5 $0.00034 $0.00400
Sonnet 5 $0.00013 $0.00160
Haiku 4.5 $0.00007 $0.00080

Measured 6d ago against content hash 589cad757a18, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, 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 6d 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 · 63 lines

How it starts

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

Write predictable, secure Terraform

Predictable infrastructure. Secure state. Modules that compose. No drift.

Module structure (standard layout)

modules/<name>/
  main.tf        # resources only — no provider config
  variables.tf   # typed inputs with descriptions and validation
  outputs.tf     # only what callers need
  versions.tf    # required_providers + minimum version constraints

Environments (envs/prod/, envs/staging/) consume modules via module blocks — never paste resources directly into env files.

Non-negotiable rules

Rule Why
Remote state backend (S3+DynamoDB or GCS) Local state breaks team workflows and loses history
State locking enabled Concurrent applies corrupt state
No credentials in .tf files Rotate via environment/vault; never hardcode
Pin provider versions with ~> Minor-version drift breaks plans silently
lifecycle { prevent_destroy = true } on data resources Accidental drops are unrecoverable

Steps

  1. Read the lore + existing modules. search_lore for state backend, naming conventions, and existing module registry. Extend existing patterns; don't introduce a competing module style.
  2. Design the module interface. Variables: typed + validated + described. Outputs: only what callers need — not every internal resource attribute. One module = one coherent infrastructure concern.
  3. Implement resources. Follow least-privilege on IAM. Encrypt at rest and in transit by default. Tag all resources with environment, team, and managed-by = terraform.
  4. Configure the backend. Remote state with locking. Workspace or path-based isolation between environments.
  5. CI/CD integration. terraform fmt + terraform validate on every PR; terraform plan as a required check; apply only on merge to main via a protected pipeline.
  6. Security review. Check for: hardcoded credentials, 0.0.0.0/0 ingress, public S3 buckets, overly permissive IAM. Use tfsec or checkov in CI.
  7. Verify. terraform plan shows expected change set only; terraform apply completes without errors; spot-check resources in cloud console; record evidence.

Read the full file on GitHub · 63 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. 6d 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 (2 stars, last pushed 2d ago), licensed Apache-2.0. It adds 67 tokens to every session and 801 once invoked, about $0.0003 per session on Opus 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.