terraform-validation
/terraform-validation
Validate Terraform syntax, linting, and security with terraform fmt/validate, tflint, and trivy. Use when committing Terraform changes, running CI validation, or checking IaC security issues.
- Author
- y-miyazaki ↗
- Repository
- terraform-aws-base ↗
- Licence
- Apache-2.0
- Last repository change
- 13.11.2026
Assessment and security
- Files in this package
- 22
- Scripts
- 10
- HTML comments
- 0
- URLs in SKILL.md
- 0
No signals detected. Repository changed on 13.11.2026, without references to retired models or APIs.
Apache-2.0, otwarta: można używać i zmieniać, z zachowaniem licencji i informacji o zmianach.
- 10 scripts in this package. Review them before installing, as Claude may execute them.
Scripts: scripts/lib/all.sh, scripts/lib/aws.sh, scripts/lib/common.sh, scripts/lib/csv.sh, scripts/lib/json.sh, scripts/lib/repo_paths.sh, scripts/lib/terraform.sh, scripts/lib/validation.sh, scripts/lib/yaml_map_order.py, scripts/validate.sh
What it does and when to use it
Validate Terraform syntax, linting, and security with terraform fmt/validate, tflint, and trivy. Use when committing Terraform changes, running CI validation, or checking IaC security issues.
Original author description
Validate Terraform syntax, linting, and security with terraform fmt/validate, tflint, and trivy. Use when committing Terraform changes, running CI validation, or checking IaC security issues.
How it works
- Input
- Output Specification
- Execution Scope
- Reference Files Guide
- Workflow
SKILL.md preview
--- name: terraform-validation description: >- Validate Terraform syntax, linting, and security with terraform fmt/validate, tflint, and trivy. Use when committing Terraform changes, running CI validation, or checking IaC security issues. license: Apache-2.0 metadata: author: y-miyazaki version: "1.0.1" --- ## Input - Terraform path or directory (required) - Validation script (required): `scripts/validate.sh` (run from the terraform-validation skill directory) - `--fix` (optional): rewrites formatting with `terraform fmt` (and argument order with `--check-order`) - `--verbose` (optional) - `--check-order` (optional): run the argument order check (ORD-01) on top-level arguments of `resource`, `data`, and `module` blocks; requires `python3` and a `terraform_attr_order.py` helper next to `validate.sh`, which this skill does not bundle - `--generate-docs` (optional): writes `README.md` in each Terraform module directory with `terraform-docs`; requires `terraform-docs`. Pass it only when the user asks for generated docs, because it changes files ## Output Specification Return structured Markdown in accordance with [references/common-output-format.md](references/common-output-format.md). That file is the source of truth for the output contract. Structured results in the script's order: tflint, terraform validate, terraform fmt, argument order (with `--check-order`), trivy (`trivy fs <target> --format table`). ## Execution Scope - **Always use `scripts/validate.sh`** for comprehensive validation. Do not run individual commands. - Script runs all checks in deterministic order and continues after a failing tool (no fail-fast). - The trivy step runs `trivy fs` with trivy's default scanners (vulnerabilities and secrets) unless the repository configures trivy (for example a `trivy.yaml` that enables `misconfig`), and its findings do not fail the step. Report trivy findings as evidence for the reviewer; do not treat a passing trivy step as proof that no misconfigurations exist. - **File changes:** `--fix` rewrites formatting (and argument order with `--check-order`); `--generate-docs` writes `README.md` files. Do not modify files otherwise. - Individual commands are for debugging only (see [references/common-individual-commands.md](references/common-individual-commands.md)). ### USE FOR: - run Terraform syntax/lint/security checks before commit - reproduce CI validation failures locally - validate a scoped Terraform directory during iterative changes ### DO NOT USE FOR: - perform design and architecture review - implement Terraform resource changes as a primary task - validate non-Terraform files ## Reference Files Guide - [common-checklist.md](references/common-checklist.md) (always read) - [common-output-format.md](references/common-output-format.md) (always read) - [common-troubleshooting.md](references/common-troubleshooting.md) (read on failure) - [common-individual-commands.md](references/common-individual-commands.md) (read on failure) - [category-security.md](references/category-security.md) (read on failure) ## Workflow 1. Run `bash scripts/validate.sh`. 2. For scoped runs, pass one or more target directories: `bash scripts/validate.sh <terraform-dir>`. 3. Use `--fix` for formatting corrections and `--verbose` for diagnostics. 4. Retry at most 2 times after fixes; if checks still fail, return blocking findings and stop. ### Error Handling | Condition | Severity | Action | | --------------------------------------------------------------------------------------------------------------------------------- | ----------- | -------------------------------------------------------------------------------------------------------------------- | | `scripts/validate.sh` missing | Fatal | Stop; report missing script | | No `.tf` files under target path | Info | Report no reviewable Terraform; stop | | Required binary missing (`terraform`, `tflint`, `trivy`; `python3` with `--check-order`; `terraform-docs` with `--generate-docs`) | Fatal | Stop; report the missing binary; set `Status: ❌ FAIL` | | `--check-order` fails with `can't open file ... terraform_attr_order.py` | Recoverable | Report argument order as `⊘ Skipped` (helper not bundled), not as an ORD-01 violation; leave ORD-01 to manual review | | Single tool fails, others succeed | Recoverable | Report every tool; mark the failed tool ❌ Fail with exit status | | All tools fail | Fatal | Set `Status: ❌ FAIL` with per-tool stderr summaries in `## Error Details` | | `common-checklist.md` unavailable | Fatal | Stop; report missing dependency | | `common-output-format.md` unavailable | Recoverable | Note missing file; emit `## Summary`, `## Tool Results`, and `## Error Details` only | ### Examples - Prompt: `Validate Terraform fmt, validate, tflint, and trivy` - Command: `bash scripts/validate.sh` - Result: Structured report per [references/common-output-format.md](references/common-output-format.md). Additional invocations: [common-individual-commands.md](references/common-individual-commands.md) (read on debugging).
Files in this package (22)
- SKILL.md 6 KB
- eval.yaml 1 KB
- evals/tasks/terraform-validation-basic.yaml 1 KB
- evals/tasks/terraform-validation-boundary-guardrail.yaml 1 KB
- evals/tasks/terraform-validation-partial-failure.yaml 1 KB
- evals/tasks/terraform-validation-structured-output.yaml 1 KB
- evals/tasks/terraform-validation-trigger-negative.yaml 1 KB
- references/category-security.md 2 KB
- references/common-checklist.md 3 KB
- references/common-individual-commands.md 1 KB
- references/common-output-format.md 2 KB
- references/common-troubleshooting.md 1 KB
- scripts/validate.sh 16 KB
- scripts/lib/all.sh 1 KB
- scripts/lib/aws.sh 31 KB
- scripts/lib/common.sh 9 KB
- scripts/lib/csv.sh 4 KB
- scripts/lib/json.sh 8 KB
- scripts/lib/repo_paths.sh 16 KB
- scripts/lib/terraform.sh 13 KB
- scripts/lib/validation.sh 14 KB
- scripts/lib/yaml_map_order.py 8 KB
Versions
| Repository | Score | Licence |
|---|---|---|
| This page · y-miyazaki/terraform-aws-base | 100 | Apache-2.0 |
| y-miyazaki/terraform-aws-base | 100 | Apache-2.0 |
Database snapshot: 13.11.2026 · package version 5059c21056d8 (SHA-256 digest of the entire package)
Downloads in the last 30 days: 1 · ranking
Report a problem with this skill: harmful content, incorrect descriptions or an author’s removal request.
Similar skills
- 100terraform-static-analysis
Run Terraform fmt, validate, tflint, Checkov and Trivy on Azure and AWS code. Use when a pull request changes Terraform, or when you wire the same checks into pre-commit and the pipeline. - 90terraform-style-check
Use when writing, reviewing, or generating Terraform HCL that must pass fmt and validate. Not for module authoring, state operations, `terraform apply`, or remote state. - 100atmos-lint
Atmos Terraform linting with TFLint: standalone `atmos terraform lint`, component-aware config discovery and toolchain versions, TFLint rule configuration, and lifecycle hooks/CI findings. Use when configuring, running, debugging, or documenting Terraform/OpenTofu linting in an Atmos project. - 90terraform-style-check
Use when writing, reviewing, or generating Terraform HCL that must pass fmt and validate. Not for module authoring, state operations, `terraform apply`, or remote state. - 100terraform-cli-setup
Terraform CLI 安装与初始化技能。当用户本地未安装 Terraform 时自动完成安装,确保 terraform 命令可用并能执行 init/validate。不负责 Provider 凭证配置,凭证在实际使用时由 terraform-skill 引导。 - 100terraform-ops
Terraform and OpenTofu infrastructure-as-code operations - project layout, state management, module design, plan/apply safety, CI/CD pipelines, and secrets. Use for: terraform, opentofu, infrastructure as code, IaC, tfstate, terraform state, terraform module, remote backend,…