How do you stop engineers from bypassing policy checks in a pipeline?
AdvancedScenarioSecrets Provisioners and Policy as Code
Answer
Situation read → A policy check that can be skipped is a suggestion.
What I'd do →
- Enforce policy in the system that applies (HCP Terraform policy sets with hard-mandatory enforcement), not in a script in the repo that PR authors can edit.
- Protect the workflow files with CODEOWNERS and branch protection; use required workflows.
- Remove direct apply credentials from humans.
- Log and review override requests (soft-mandatory).
Why → If the PR author controls the check, they control the result.
Interview tip → Know advisory, soft-mandatory and hard-mandatory.
More on Secrets Provisioners and Policy as Code
A developer hardcodes a DB password in `terraform.tfvars` and commits it. What do you do right now, and what's the long-term fix?BeginnerHow do you avoid Terraform persisting a secret in state when creating a secret in AWS Secrets Manager?AdvancedSomeone wants a `remote-exec` provisioner to configure servers after creation. What's your advice?BeginnerYou must run a one-off command after a resource is created, such as registering with an external system.IntermediateHow do you generate and manage the master password for a new RDS instance?IntermediateCompare Sentinel, OPA/Conftest and Checkov for policy as code.Intermediate