Pulumi Dynamic Providers Design Prompt
Design a Pulumi dynamic provider to manage a resource no existing provider covers — a SaaS API, internal service, or custom lifecycle — with correct create/update/delete and diff semantics.
- Target user
- Engineers extending Pulumi to manage custom or unsupported resources
- Difficulty
- Advanced
- Tools
- Claude, ChatGPT
The prompt
You are a senior engineer who has written Pulumi dynamic providers and understands how easy it is to corrupt state with a bad diff or delete. I will provide: - The resource I need to manage (SaaS API, internal control plane, DB object, DNS/record system) - The API's CRUD operations, auth, and idempotency guarantees - Language and whether inputs contain secrets - Any prior attempt and where it broke (spurious replacements, orphaned resources) Your job: 1. **Dynamic provider vs alternatives** — confirm a dynamic provider is right vs a full provider, a ComponentResource, or a command/local-exec approach. Note the limitation that dynamic-provider code is serialized into state. 2. **Implement the lifecycle** — design the `create`, `read`, `update`, `delete`, and `diff` methods: - `create` returns a stable physical ID and outputs - `diff` decides update-in-place vs replacement correctly (which input changes force replacement) - `update` mutates without recreating when possible - `delete` is idempotent and tolerates an already-deleted resource - `read` supports import/refresh 3. **State & secrets** — mark secret inputs/outputs as secret so they're encrypted in state, and keep the serialized provider free of embedded credentials. 4. **Idempotency & drift** — handle API eventual consistency, retries, and the case where the remote resource was changed or deleted out of band. 5. **Testing** — test each lifecycle method against a fake/sandbox API, especially the `diff` replacement logic, since a wrong diff destroys and recreates real resources. 6. **Ergonomics** — wrap the dynamic resource in a typed, documented interface so consumers don't touch the raw provider. Output as: (a) a fit recommendation, (b) the dynamic provider implementation skeleton in my language with all lifecycle methods, (c) the diff/replacement decision table, (d) the secret-handling approach, (e) lifecycle test examples. Bias toward: correct idempotent delete, a conservative diff that avoids surprise replacements, and secrets that never land in plaintext state.
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 Resource Options Review Prompt
Apply Pulumi resource options correctly — dependsOn, protect, ignoreChanges, aliases, deleteBeforeReplace, retainOnDelete — so ordering, protection, and refactors behave exactly as intended instead of causing surprise replacements.
-
Pulumi Import of Existing Resources Prompt
Bring existing cloud resources under Pulumi management with pulumi import — generating code and adopting state — so clickops and legacy infrastructure become IaC without downtime or recreation.
-
Pulumi Unit & Integration Testing Prompt
Design a Pulumi test strategy — fast unit tests with mocks plus real integration tests — so component logic and deployed behavior are both verified before infrastructure changes ship.
-
Pulumi Automation API Programmatic Deployments Prompt
Design a programmatic deployment layer with the Pulumi Automation API — driving stacks from your own code or service — so you can build self-service infra, custom orchestration, and platform APIs without shelling out to the CLI.
More Pulumi prompts & error guides
Browse every Pulumi 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.