Compare Sentinel, OPA/Conftest and Checkov for policy as code.
IntermediateScenarioSecrets Provisioners and Policy as Code
Answer
Situation read → You need guardrails before apply.
What I'd do →
- Checkov/Trivy: static scanning of HCL with hundreds of built-in rules; fast adoption.
- OPA with Conftest: custom Rego policies evaluated against
terraform show -jsonplan output; vendor-neutral. - Sentinel: HashiCorp's policy language, integrated into HCP Terraform with enforcement levels.
- Pair a built-in scanner with custom OPA or Sentinel for company-specific rules.
Why → Scanners cover generic best practice; plan-based policies can reason about final values and cost.
Interview tip → Plan-based checks catch values that only exist after expression evaluation.
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?IntermediateHow do you prevent public S3 buckets from ever reaching production via Terraform?Intermediate