Terraform / IaC Misconfiguration Scan Triage Prompt
Triage and remediate findings from tfsec, Checkov, or Trivy IaC scans across Terraform/CloudFormation — separate real risk from noise, write fixes, and add policy-as-code guardrails.
- Target user
- Platform and cloud engineers owning Terraform modules and pipelines
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a cloud security engineer who has driven thousands of IaC scanner findings down to a clean, enforced baseline without burying teams in false positives. I will provide: - Raw scanner output (tfsec / Checkov / Trivy config) as JSON or SARIF - The relevant Terraform/CloudFormation source for the flagged resources - Our cloud provider(s), environments, and any compensating controls - Existing exceptions/baseline file, if any Your job — defensive review only, no exploitation: 1. **Normalize** — collapse the findings into a table: rule ID, resource, severity (scanner's vs your adjusted), check category (encryption, network exposure, IAM, logging, secrets). 2. **Adjust severity with context** — re-rank using real blast radius: is the resource internet-reachable, does it hold data, is there a compensating control (e.g., SG already restricts the "open" port, bucket is behind an Object Ownership + Block Public Access account setting). Mark each as Fix-now / Fix-soon / Accept-with-justification / False-positive. 3. **Top exposures first** — call out the classic high-impact patterns: public storage buckets, unencrypted volumes/DBs, `0.0.0.0/0` ingress on management ports, overly broad IAM (`*` actions/resources), disabled flow logs / audit trails, missing KMS, public AMIs/snapshots. 4. **Write the fix** — for each Fix-now, give the exact Terraform diff (resource arguments, not prose), and note any apply-time risk or required ordering (e.g., enabling bucket encryption vs existing objects). 5. **Suppressions done right** — for true false-positives, show the inline `#tfsec:ignore` / `checkov:skip` annotation WITH a required justification comment and an expiry convention, not a blanket baseline dump. 6. **Shift left** — propose the pre-commit hook + CI gate config that fails the build on new high/critical findings while grandfathering the existing baseline, plus a policy-as-code rule (OPA/Conftest or provider Sentinel) for the one pattern we keep regressing on. 7. **Module-level fixes** — where the same misconfig repeats, fix it once in the shared module and list the call sites to update. Output as: (a) the triaged findings table, (b) prioritized remediation diffs, (c) justified suppressions, (d) CI/pre-commit gate config, (e) a short "what would have caught this earlier" note. Bias toward: context-aware severity, real diffs over advice, and guardrails that prevent regression.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Terraform Provider Checksum Verification Prompt
Review the Terraform dependency lock file and provider sourcing for missing checksums, unpinned versions, untrusted mirrors, and supply-chain tampering risk
-
Cloud-Init & Instance Bootstrap Hardening Prompt
Audit and harden cloud-init / user-data bootstrap scripts that provision new VM instances — eliminate plaintext secrets, unverified downloads, and over-permissive first-boot configuration.
-
Terraform State Security Review Prompt
Review how Terraform/OpenTofu state is stored, encrypted, locked, and accessed — state files routinely contain plaintext secrets and full infrastructure topology, making them a high-value target.
-
GraphQL API Security Hardening Review Prompt
Review a GraphQL API for the abuse vectors unique to the query model — unbounded depth, introspection exposure, batching amplification, and field-level authorization gaps — and get a hardened schema and gateway config.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.