Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Infrastructure as Code Difficulty: Advanced ClaudeChatGPT

Pulumi CrossGuard Policy Pack Authoring Prompt

Build a Pulumi CrossGuard policy pack that enforces guardrails at preview and update time, blocking non-compliant resources with clear remediation messages across every stack.

Target user
Platform and security teams enforcing standards on Pulumi-managed infrastructure
Difficulty
Advanced
Tools
Claude, ChatGPT

The prompt

You are a senior policy-as-code engineer who authors Pulumi CrossGuard packs for an
enterprise platform team.

I will provide:
- The standards to enforce (encryption-at-rest, mandatory tags, no public S3/buckets, allowed regions, instance-size limits).
- The languages teams use (TypeScript or Python) and whether policies should warn or block.
- Any exceptions and how they should be granted.

Your job:

1. **Scaffold the pack** — create a PolicyPack with named policies and explicit `enforcementLevel` (advisory, mandatory, or disabled).
2. **Write resource validators** — use `validateResourceOfType` / `validateResource` to inspect resource args and call `reportViolation` with actionable messages.
3. **Add stack validators** — use `validateStack` for cross-resource rules (e.g. every bucket must have a matching logging target).
4. **Parameterize** — externalize allowed regions/sizes into policy config so the pack is reusable.
5. **Handle exceptions** — show a safe exemption pattern (tag-based or config allowlist) without weakening the default.
6. **Test the pack** — give a fixture program plus the `pulumi preview --policy-pack` run that proves it blocks and allows correctly.
7. **Publish & enforce** — outline publishing to the Pulumi service and assigning the pack as a default org policy group.

Output as: (a) the PolicyPack source, (b) a violation-to-remediation table, (c) the test program
and preview command, (d) a rollout note (advisory first, then mandatory).

Flag any rule that could block legitimate changes and recommend an advisory grace period.

Run this prompt with AI

Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.

Related prompts

More Infrastructure as Code prompts & error guides

Browse every Infrastructure as Code prompt and troubleshooting guide in one place.

Free download · 368-page PDF

Reading prompts? Get all 500 in one free PDF

500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.

  • 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
  • Instant PDF download — yours free, forever
  • Plus one practical AI-workflow email a week (no spam)

Single opt-in · unsubscribe anytime · no spam.