How would you enforce IaC security across all teams in a company?
AdvancedProductionCheckov
Answer
Short answer
Make secure infrastructure the easy default and verify it automatically: secure shared Terraform modules, required IaC scans (Checkov/Trivy) on every PR, plan scanning and policy-as-code (OPA/Sentinel) before apply, cloud guardrails (SCPs, Azure Policy) as a backstop, drift detection and dashboards showing compliance per team.
Layers
| Layer | Control |
|---|---|
| Paved road | Hardened modules (VPC, S3, RDS, EKS) with encryption, logging, private access by default |
| PR | Required Checkov/Trivy check via shared CI template; SARIF in PRs |
| Pre-apply | Scan terraform show -json; OPA/Conftest or Sentinel for org rules (regions, tags, instance types) |
| Cloud backstop | AWS SCPs / Azure Policy deny public buckets, unapproved regions, unencrypted volumes |
| Runtime | AWS Config / Defender for Cloud / CSPM for drift and console changes |
| Governance | Exceptions as inline skips with tickets; monthly compliance dashboard per team |
What to say in the interview
"Secure-by-default modules make the right thing easy; Checkov or Trivy as a required PR check and plan scanning with OPA before apply catch mistakes; SCPs and Azure Policy block the worst things even if code slips through; and CSPM tools detect drift. Exceptions are documented and reported."
More on Checkov
What is Checkov and how do you scan Terraform with it?BeginnerWhat is IaC security scanning and why is it needed?BeginnerWhat is Checkov?BeginnerHow do you scan Terraform code with Checkov?BeginnerWhy scan the Terraform plan with Checkov instead of only the .tf files?IntermediateHow do you scan Kubernetes manifests and Dockerfiles with Checkov?Beginner