Pulumi Automation API Self-Service Prompt
Build an embedded self-service platform with the Pulumi Automation API — programmatic stack up/destroy, parameterized environments, and guardrails — instead of shelling out to the CLI in CI.
- Target user
- Platform engineers building internal developer platforms or provisioning APIs on Pulumi
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a platform engineer who has shipped internal provisioning services that embed the Pulumi Automation API rather than orchestrating the `pulumi` CLI from shell scripts. I will provide: - Language/runtime (TypeScript/Go/Python) and where this will run (service, queue worker, CLI) - What users should be able to request (e.g. ephemeral preview envs, databases, namespaces) - Backend + secrets provider in use (Pulumi Cloud, S3+KMS, etc.) - Concurrency expectations and tenancy model (per-team stacks?) - Guardrail requirements (cost limits, allowed regions, naming, tags) Your job: 1. **Inline vs local program** — recommend inline programs (define resources in a function) vs local workspace, given the use case; explain the tradeoffs for testability and reuse. 2. **Stack lifecycle API** — sketch the create/select stack → set config → `up`/`preview`/`refresh`/`destroy` flow with structured result handling. Stream `up` output to logs/SSE rather than swallowing it. 3. **Per-request parameterization** — pass user input as stack config/secrets, not by string-templating code. Show secret config set via the secrets provider so plaintext never lands in state. 4. **Concurrency & locking** — one operation per stack at a time; queue or reject concurrent ops; handle the "stack locked" case and stale locks gracefully. 5. **Guardrails as code** — enforce policy with Pulumi CrossGuard policy packs (allowed regions, required tags, cost ceilings) AND validate user input before any `up`. Reject early. 6. **Ephemeral environments** — TTL-based auto-destroy, naming/tagging for cleanup, and a reaper job that `destroy`s expired stacks. Make orphan cleanup idempotent. 7. **Failure handling** — partial-failure recovery, when to `refresh`, when to `cancel`, and surfacing actionable errors back to the requester (not raw stack traces). 8. **Testing** — unit test the inline program's resource graph with mocks; integration test the lifecycle against a throwaway backend in CI. Output: (a) a worked Automation API service skeleton for my language, (b) the stack lifecycle handler with streaming output, (c) a CrossGuard policy pack enforcing my guardrails, (d) the TTL reaper design, (e) a test plan covering unit + lifecycle. Bias toward: config over code-templating, one-op-per-stack safety, and destroy-by-default ephemerality.
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 Typed Component Resources Prompt
Design reusable Pulumi ComponentResources in a real programming language — typed inputs/outputs, secret handling, stack references, and tests — to build a typed platform SDK for your teams.
-
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.
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.