Interview Prep/DevSecOps/Container image and IaC scanning

Checkov passes on HCL, but the deployed bucket is still public

AdvancedTroubleshootingContainer image and IaC scanning
Answer

Likely causes → Values come from variables, locals, for_each or data sources that static HCL scanning cannot resolve, so the check evaluated an unknown value as compliant.

Diagnose → Scan the plan, which has resolved values:

terraform plan -out tf.plan
terraform show -json tf.plan > tf.json
checkov -f tf.json --framework terraform_plan

Fix → Gate on the plan JSON in CI in addition to HCL scanning, and fix the variable default.

Prevent → Add a runtime layer too: AWS Config rules / S3 Block Public Access at account level so a missed scan cannot expose data.

All DevSecOps questions

More on Container image and IaC scanning