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
-
Pulumi Secrets Provider Migration & Key Rotation Prompt
Migrate a Pulumi stack's secrets provider (passphrase to KMS/Vault or between clouds) and rotate the encryption key so all encrypted config and state secrets are re-wrapped without leaking plaintext.
-
Pulumi Transformations & Aliases Refactor Prompt
Refactor Pulumi resource names, parents, and structure at scale using aliases and stack transformations so URNs change on paper but no live resource is destroyed or replaced.
-
Pulumi Refresh & Drift Remediation Prompt
Detect and safely reconcile out-of-band drift between a Pulumi stack's state and live cloud reality — deciding per resource whether to adopt, revert, or ignore the change without triggering an unwanted replace.
-
Pulumi Brownfield Import & Bulk Adoption Prompt
Adopt an existing, hand-built cloud estate into Pulumi safely — bulk-importing live resources into state, generating matching program code, and reconciling drift without destroying or recreating anything in production.
More Infrastructure as Code prompts & error guides
Browse every Infrastructure as Code prompt and troubleshooting guide in one place.
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.