100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace
Infrastructure as Code — Terraform & Ansible
25 minintermediate

Checkov and tfsec — Static IaC Security Scanning

Static IaC security scanners analyse Terraform configurations before any resources are created, identifying security misconfigurations that would expose infrastructure to attack. While tflint catches semantic errors (invalid instance types, deprecated arguments), security scanners like Checkov and tfsec focus on security posture: public S3 buckets, unencrypted databases, permissive security groups, missing audit logging, and hundreds of other findings mapped to CIS Benchmarks, AWS Security Hub controls, SOC 2 compliance requirements and the MITRE ATT&CK framework. Running these tools in CI creates a security gate that prevents misconfigurations from ever reaching production infrastructure — catching a publicly readable S3 bucket in a PR review takes minutes to fix; discovering the same bucket after a data breach costs millions.

Checkov (by Bridgecrew, acquired by Palo Alto Networks) is the more comprehensive scanner, with over 1,000 built-in checks covering Terraform, CloudFormation, ARM templates, Kubernetes manifests, Dockerfiles, GitHub Actions workflows, and Ansible playbooks. tfsec (now part of Trivy, by Aqua Security) focuses specifically on Terraform and has excellent provider coverage. Both tools are open source, fast (seconds to scan hundreds of files), and integrate with major CI platforms. For organisations already using Prisma Cloud or Aqua Security, the respective tools have native integration with those platforms. The choice between Checkov and tfsec is often organisational rather than technical — both catch the most important security issues. Many mature security programmes run both, using their overlapping and complementary rule sets to maximise coverage.

Analogy🏏Cricket
🏏 Think of it like cricket: Terraform Cloud is the ICC's centralised match management platform — instead of each national board (team) maintaining its own scoring system, umpire assignment software and results database (self-managed CI/CD + S3 backend), the ICC platform handles all of this centrally. When a board member proposes a rule change (pull request), the platform automatically simulates the match under the new rules (speculative plan on PR), shows the referees the impact (plan output in PR comment), and requires the match committee to approve (policy gates) before the rule takes effect. The audit log records every change, every approval, and who made each decision — providing the governance and traceability that serious tournament operations require.
Lesson 10 of 33
0% complete