Terraform PR Request
Infra change PR opened in minutes, applied within SLA
Terraform PRs are where security policy meets infrastructure changes. Engineer submits a PR to add a new S3 bucket, IAM role, security group — every change potentially introduces exposure. Manual security review of every PR doesn't scale; automated linters (tfsec, Checkov) produce noise; security team either becomes a bottleneck or misses risky changes. Neither works.
An hour-by-hour walkthrough.
Step by step.
- 01
Detect Terraform PRs + parse changes
GitHub / GitLab PR webhook. Parse Terraform plan output + resource changes.
GitHub · GitLab · Terraform plan output - 02
Analyze against security policy
Bucket policies, IAM permissions, encryption, logging, network exposure, secrets handling. Full policy check per resource type.
Policy engine · tfsec · Checkov · custom policies - 03
Score + comment with inline suggestions
Blocking issues + recommendations + approved sections. Suggested code changes as PR comments.
GitHub / GitLab review API · Code suggestion engine - 04
Re-review on push
Engineer addresses feedback; Sig re-reviews automatically. Iterative refinement until clean.
Webhook re-trigger · State tracking - 05
Approve or escalate
Clean PR gets Sig security approval. Blocking issues + engineer disputes escalate to security team review.
PR approval · Security team escalation
What you connect to make this run.
GitHub · GitLab · Bitbucket
read+writePR webhook + comment + approve flow. Standard Git repository interaction.
tfsec · Checkov · Terrascan
readPolicy-as-code enforcement. Baseline rules + custom rules per company.
Terraform plan output
readResource-level change analysis. Not just source code; actual resource impact.
Security team escalation queue
writeDisputes or novel patterns route for human review. Common patterns become policy rules.
Before and after, honestly.
Playbooks that pair with this one.
Answers about this playbook.
What about non-Terraform IaC (Pulumi, CDK, CloudFormation)?
Same policy engine, different parsers. Pulumi + CDK + CloudFormation supported with equivalent analysis.
How does it handle policy exceptions (legitimate broad permissions)?
Exception request flow (see security-exception-handling). PR annotation with approved exception reference; Sig respects the exception.
What if the automated review is wrong (false positive)?
Engineer disputes with reason; security team reviews. False positives feed policy tuning. Never gates a PR forever on questionable finding.
How does it handle secrets in code?
Additional pre-commit + PR-time scanning. Detected secrets block merge + trigger rotation of the exposed secret.
Can it integrate with CI/CD gating?
Yes — CI/CD gate on Sig approval status. PR can't merge to protected branches without security clearance.
See it run on your data.
Free plan, no credit card. Connect the systems this playbook needs and run it against a past event first.