---
name: "tfsec-terraform-security-linter"
description: "Detect cloud infrastructure security flaws locally before provisioning resources."
metadata:
  author: "Aqua Security"
  version: "1.0.0"
  runtime_compatibility:
    - "codex"
    - "claude-code"
    - "cursor"
    - "windsurf"
triggers:
  - "run tfsec scan"
  - "fix terraform security alert tfsec"
  - "audit aws terraform tfsec"
permissions:
  fs_read: true
  fs_write: "workspace"
  shell_exec: false
  net_access: false
---

# tfsec Pre-Deployment Terraform Security Linter

Runs tfsec static analysis against Terraform code: evaluating resource blocks, references, and variables against cloud security benchmarks (AWS, Azure, GCP).

## When to Invoke
Invoke this skill whenever you need to:
- run tfsec scan
- fix terraform security alert tfsec
- audit aws terraform tfsec

## Execution SOP & Rules
1. Execute tfsec . in the root of the Terraform project before running terraform plan.
2. Review remediation advice provided in tfsec output and apply recommended attributes.
3. Ensure sensitive variables declare sensitive = true to prevent cleartext logging.
4. Combine tfsec checks into CI/CD pipelines to prevent drift.

## Verification Checklist
- Run local linting, syntax validation, and type-checks before reporting completion.
- Ensure all created or modified files adhere to workspace boundaries and avoid uncommitted secrets.
- Verify tests or build commands exit cleanly with return code 0.
