180-terraform

180-terraform is a cursor rule for Cursor from d-padmanabhan/agent-engineering-handbook. It costs 16 tokens per session (10,049 once invoked), scanned A, original, MIT.

A set of engineering rules for Terraform, a tool that describes and manages cloud infrastructure in code. It covers reusable modules, protected state, validation, security, and plan reviews.

In plain words
What is it for?
Use it when writing or reviewing Terraform providers, modules, resources, state handling, validations, documentation, and CI checks.
Why use it?
It helps prevent unsafe infrastructure changes, duplicated configuration, leaked secrets, and unexpected differences between planned and deployed resources.

Cursor rule for Cursor

Written for Cursor: a Cursor rule (.mdc).

Needs its repository: it reads a path above its own folder, which exists only inside the repository. The line is source = "../../modules/vpc".

Good fit Use it when writing or reviewing Terraform providers, modules, resources, state handling, validations, documentation, and CI checks.

Compare 6 cursor rules from other repositories ↓
Install

Getting it into your agent

It runs from inside its repository, so the clone comes first — what it calls does not travel with the file alone.

Clone the repo
git clone --depth 1 https://github.com/d-padmanabhan/agent-engineering-handbook
agentmods
npx agentmods add rules/d-padmanabhan/agent-engineering-handbook/180-terraform

Made for: Cursor.

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 180-terraform

README.md
[![agentmods](https://agentmods.dev/badge/rules/d-padmanabhan/agent-engineering-handbook/180-terraform.svg)](https://agentmods.dev/rules/d-padmanabhan/agent-engineering-handbook/180-terraform)
Your own site
<a href="https://agentmods.dev/rules/d-padmanabhan/agent-engineering-handbook/180-terraform"><img src="https://agentmods.dev/badge/rules/d-padmanabhan/agent-engineering-handbook/180-terraform.svg" alt="Measured on agentmods" height="20"></a>
Per session 16 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 10,049 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.00016 $0.10049
Opus 5 $0.00008 $0.05025
Sonnet 5 $0.00003 $0.02010
Haiku 4.5 $0.00002 $0.01005

Measured 7d ago against content hash f05de8db2e3e, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-07, from the pricing page.

Security

Grade A, and why

180-terraform 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 7d 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.

rules/180-terraform.mdc · 1,683 lines

How it starts

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

Terraform Engineering Ruleset - (December 2025)

Audience: engineers writing and reviewing Terraform infrastructure as code Goal: secure-by-default, efficient, modular, and highly maintainable Terraform - without over-engineering

Terraform Philosophy (Core Principles)

Core Principles:

  • "Infrastructure as Code, not Infrastructure as Config" - Terraform is code; treat it with same rigor as application code
  • "State is the source of truth" - Protect state, version it, back it up, lock it
  • "Idempotency is non-negotiable" - Same input should produce same output, safe to run multiple times
  • "Modules over copy-paste" - Reusable, composable modules reduce errors and maintenance
  • "Validate early, fail fast" - Use validations, preconditions, postconditions to catch errors early
  • "Security by default" - Least privilege IAM, encryption everywhere, no secrets in code
  • "Explicit over implicit" - Clear dependencies, explicit providers, documented assumptions
  • "Plan before apply" - Always review plan output, use saved plans in CI/CD

Applying Terraform Principles:

# BAD: Implicit, insecure, fragile
resource "aws_instance" "web" {
  ami           = "ami-12345"
  instance_type = "t2.micro"
}

# GOOD: Explicit, secure, validated
variable "environment" {
  type        = string
  description = "Deployment environment"
  validation {
    condition     = contains(["dev", "staging", "prod"], var.environment)
    error_message = "Environment must be dev, staging, or prod."
  }
}

resource "aws_instance" "web" {
  ami           = data.aws_ami.ubuntu.id
  instance_type = var.instance_type

  vpc_security_group_ids = [aws_security_group.web.id]
  subnet_id              = aws_subnet.public["az-a"].id

  tags = merge(
    local.common_tags,
    {
      Name = "${var.app}-${var.environment}-web"
    }
  )

  lifecycle {
    create_before_destroy = true
    prevent_destroy       = var.environment == "prod"
  }
}

Quick Reference

Read the full file on GitHub · 1,683 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. 7d ago First seen · 1,683 lines · 16 tokens per session scan A f05de8db2e3e

Subscribe to this mod's changes

180-terraform is a cursor rule published in the GitHub repository d-padmanabhan/agent-engineering-handbook (16 stars, last pushed 8d ago), licensed MIT. It adds 16 tokens to every session and 10,049 once invoked, about $0.0001 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-08-30.