Skip to content
CloudOps
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.
Newsletter

Free: the DevOps AI Incident-Triage Cheat Sheet

Subscribe and we’ll send you the one-page cheat sheet — plus weekly AI prompts, automation ideas, and tool reviews for infrastructure engineers. One email a week. No spam, unsubscribe anytime.

  • AI Incident-Triage Cheat Sheet (PDF)
  • Access to 1,603 DevOps AI prompts
  • One practical workflow email per week