agentleFS
harshgoyal1harshgoyal1/cloud-architect-skills/skills/terraform-security-review/SKILL.md

terraform-security-review

Skill1 starsChanged 3 months agoMITView on GitHub

Security review of Terraform, OpenTofu or Bicep infrastructure code — public exposure, IAM over-permission, secrets, encryption, logging, network reachability and state security. Use when the user asks to review IaC for security, check Terraform before apply, audit infrastructure code, or find misconfigurations in a cloud module.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 3 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Read the code. Follow the data path.

    line 8
  2. Distinctive:

    Check the plan if available.

    line 15
  3. Distinctive:

    No finding without a file and line.

    line 81

≈ “Common” is an estimate: at least 1 in 5 of the 372,429 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

IaC Security Review

Read the code. Follow the data path. Report only what the code actually does.

Method

  1. Map what is created: compute, storage, data, network, identity.
  2. For each, ask: who can reach it, who can act on it, what is logged, what is encrypted.
  3. Trace variables to their defaults — a permissive default is a real finding.
  4. Check the plan if available; code and plan can diverge via conditionals and modules.
  5. Rate: Critical / High / Medium / Low, judged by exploitability and data exposure.

Exposure

  • Resources with public IPs, public endpoints, or 0.0.0.0/0 inbound
  • Storage buckets/accounts allowing anonymous or public read
  • Databases reachable from the internet or from the whole VNet/VPC
  • Security groups / NSGs with wide ranges, any protocol, or management ports open
  • Load balancer and ingress TLS: version floor, cipher policy, redirect from HTTP
  • Missing private endpoints where the provider supports them

Identity and permissions

  • Wildcard actions or resources in policies (*), Owner/Contributor where a narrower role fits
  • Roles assigned at subscription/account scope when resource-group scope suffices
  • Service principals or IAM users with long-lived static credentials
  • AssumeRole / federation trust policies with overly broad principals or missing conditions
  • Privilege escalation paths: identities that can grant themselves more (iam:*, role assignment writes)
  • Cross-account/cross-tenant trust without external ID or condition constraints

Secrets

  • Hardcoded credentials, keys, tokens, connection strings, certificates
  • Secrets in variables.tf defaults, terraform.tfvars, or committed .auto.tfvars
  • Secrets passed as plain environment variables to compute
  • Sensitive outputs not marked sensitive
  • Vault references present but with unrestricted access policies

Data protection

  • Encryption at rest: enabled, and customer-managed keys where the data class requires
  • Encryption in transit enforced (TLS minimum version, https_only, no plaintext ports)
  • Public snapshot/image sharing
  • Backup configured; retention meets requirement; deletion protection on production data
  • Soft delete / purge protection on key vaults and storage

Logging and detection

  • Audit/activity logging enabled and shipped off the resource
  • Flow logs on network boundaries
  • Diagnostic settings on data services
  • Log retention explicit, not provider default
  • Immutable or write-once storage for audit trails where compliance requires

State and pipeline

  • Remote state backend: encrypted, versioned, access-restricted, locking enabled
  • State not in the repo; no .tfstate committed
  • Provider versions pinned; module sources pinned to a tag or commit, not a moving branch
  • CI identity federated (OIDC) rather than a stored key
  • Plan output not exposed in public pipeline logs

Output

## IaC Security Review — <repo/module>

| # | Severity | Finding | Location |
|---|---|---|---|
| 1 | Critical | | file:line |

For each: what the code does, why it is exploitable, the fix (with the corrected
snippet), and any blast-radius note.

### Clean
<controls you verified as correctly implemented — say what is right, briefly>

### Not verifiable from code
<anything requiring runtime or console access>

No finding without a file and line. If a check does not apply, omit it rather than writing "N/A".

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.