Interview Prep/Terraform/Secrets Provisioners and Policy as Code

How do you prevent public S3 buckets from ever reaching production via Terraform?

IntermediateScenarioSecrets Provisioners and Policy as Code
Answer

Situation read → Defence in depth.

What I'd do →

  1. Module default: aws_s3_bucket_public_access_block with all four flags true.
  2. CI scan: checkov -d . --framework terraform fails the PR on public ACLs.
  3. Account-level S3 Block Public Access and an SCP as backstop.

Why → If a resource slips through code review, the account control still blocks it.

Interview tip → Layer the checks: module, pipeline, org.

All Terraform questions

More on Secrets Provisioners and Policy as Code