S
Situation
Most cloud breaches come from misconfiguration, not sophisticated attacks: storage left public, databases open to the internet, service accounts with far more access than they need. After the Google Cloud Cybersecurity Certificate, I wanted to apply what I learned with infrastructure-as-code, the way cloud teams actually work.
T
Task
Design a small "customer portal" on Google Cloud (VM, Cloud SQL database, storage bucket), first with realistic misconfigurations, then secure it to industry benchmarks. Prove the improvement with automated scanning that would block regressions.
A
Action
- Wrote the insecure version in Terraform with 8 deliberate misconfigurations: SSH and RDP open to the internet, a project-wide Editor service account with a downloadable key, a VM with a public IP, a publicly readable bucket, a database open to 0.0.0.0/0 without TLS or backups, and no data-access audit logs.
- Rebuilt it securely: a custom VPC with flow logs, SSH only through Identity-Aware Proxy, least-privilege IAM with no keys, a Shielded VM with OS Login and no public IP, Cloud NAT for outbound traffic, public access prevention and versioning on storage, a private-IP database with client-certificate TLS, backups and pgAudit, customer-managed encryption keys (Cloud KMS), and data-access audit logs.
- Scanned both versions with Checkov, and wrote three custom policies for gaps the built-in checks missed (auto-mode VPC, service account keys, firewall logging).
- Added a GitHub Actions pipeline that runs terraform fmt, validate and the scan, and fails if the secure version regresses.
R
Result
- Failed checks dropped from 31 to 0 (74 passing), with one accepted exception documented in the code.
- My three custom policies now catch issues the scanner missed by default.
- Found that one misconfiguration, missing data-access audit logs, can't be detected by any scanner because it's something absent rather than a bad setting. This is a strong argument for combining automated scanning with manual review.
