Terraform review

From y-miyazaki/terraform-aws-base · View interactive version

Terraform review is an AI agent skill from the GitHub repository y-miyazaki/terraform-aws-base. Review Terraform quality, security, and architecture decisions. Use when reviewing Terraform PRs requiring judgment beyond automated checks across modules and environments.

How to use this skill

Skill file

Input

Output Specification

Return structured Markdown in accordance with references/common-output-format.md. That file is the source of truth for the output contract.

Each issue must include file path with line reference (<path>#L<line>), risk summary, and remediation guidance.

Execution Scope

USE FOR:

DO NOT USE FOR:

Reference Files Guide

Workflow

  1. Read PR context and module scope. If PR context is unavailable, review file diffs only and defer PR-context-dependent checks.
  2. If changed files contain no .tf or .tfvars, set Status: skipped in ## Checks Summary with reason no Terraform review target.
  3. Scope findings to changed files and hunks. Report violations in unchanged code outside the diff only under ## Expert Assessment, not ## Issues. For ad-hoc file review without a diff, treat the whole file as in scope.
  4. Exclude generated files and vendored third-party code (for example .terraform/ directories and .terraform.lock.hcl) from primary findings unless they introduce security-critical risk.
  5. For very large PRs (>50 changed Terraform files), prioritize security/correctness checks first and defer low-risk style checks if evidence is insufficient.
  6. When validation output (companion terraform-validation report or equivalent CI results) is supplied, do not re-report failures those tools detect: take the overlapping ItemID's status from the tool result, cite the tool, and spend the review on judgment checks. Category items with a validation Note: name the known overlaps.
  7. Apply the full review checklist and collect failed/deferred items. For CFG-* checks, also look for what is missing per category-config.md.
  8. For every finding, search the repository for sibling occurrences of the same pattern (including the mirrored side of paired modules or stacks) and fill Siblings (none found when empty).
  9. Before judging any resource or module call (arguments, defaults, required permissions, service behavior), read its documentation at the version pinned in the code, such as the Terraform Registry page for the provider resource or module. Do not decide from memory. When the documentation cannot be read, defer the check or report the claim under Unverified; never state it as fact.
  10. If a referenced category file is missing, defer affected checks with the missing file path.
  11. Output required sections per references/common-output-format.md. Prioritize SEC-* findings first, then correctness, then maintainability. For conflicting findings, prioritize the higher-severity category and document the conflict in ## Issues.

Error Handling

| Condition | Severity | Action |

| ---------------------------------------- | ----------- | ----------------------------------------------------------------------------------------------------- |

| common-checklist.md unavailable | Fatal | Stop; report missing dependency |

| common-output-format.md unavailable | Recoverable | Note missing file; emit ## Checks Summary, ## Checks (Failed/Deferred Only), and ## Issues only |

| Changed files contain no .tf/.tfvars | Recoverable | Set Status: skipped in ## Checks Summary; reason no Terraform review target |

| Referenced category file missing | Recoverable | Defer affected checks; note missing file path |

Examples

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.