Your Rules, Enforced Automatically
Custom Policies let you define organization-specific rules for your IaC. Naming conventions, required tags, encryption requirements, forbidden configurations—if you can describe it, you can enforce it.Your Rules
Define exactly what compliant infrastructure looks like
Auto-Enforced
Checked on every PR and agent session
Version Controlled
Track changes, rollback if needed
Test First
Preview mode before enforcement
Custom Policies is a Feature Preview. Enable it in Settings → Features.
Quick Example
Here’s a policy requiring encryption on all S3 buckets:Creating a Policy
Severity Levels
| Level | When to Use | Blocks Merge? |
|---|---|---|
| 🔴 Critical | Public exposure, data leak risk | Yes (if configured) |
| 🟠 High | Missing encryption, weak IAM | Recommended |
| 🟡 Medium | Missing logging, no tags | Optional |
| 🔵 Low | Naming conventions | No |
Common Policies
- Security
- Tagging
- Naming
- Config
Where Policies Apply
PR Reviews
Violations appear as review comments. Can block merge on Critical.
AI Agents
Agent follows policies when generating code. Violations flagged before PR.
Per-Repository Overrides
- Exclude specific repos from policies
- Apply stricter rules to production repos
- Different policies for different teams
Testing Before Enforcing
Preview Mode
- Create policy with scope: Disabled
- Run manual scan on a repo
- See what would be flagged
- Adjust rules
- Enable when ready
Dry Run
- See affected resources across all repos
- Estimate violation count
- Identify false positives
- Refine before enforcement
Version Control
Every policy change is tracked:| Feature | What It Does |
|---|---|
| History | See all versions, who changed what |
| Compare | Diff between versions |
| Rollback | Revert to any previous version |
| Audit | Full change log for compliance |
Handling Violations
When a policy is violated, you can:| Action | When to Use |
|---|---|
| Fix it | Update the resource to comply |
| Accept risk | Document why it’s ok (with justification) |
| Update policy | Add exception for this case |
| Suppress | Ignore for specific resources |
Best Practices
Start with Templates
Use built-in templates as starting points
Test First
Preview mode before enforcement
Document Why
Clear descriptions help future you
Review Quarterly
Keep policies current
Troubleshooting
| Problem | Fix |
|---|---|
| Policy not evaluating | Check scope isn’t “Disabled”, repo isn’t excluded |
| Too many false positives | Add exceptions, narrow conditions |
| Changes not taking effect | Make sure you saved, check for rollbacks |