Pulumi Component Resource Design Prompt
Design reusable Pulumi ComponentResources with typed inputs, clean outputs, and proper parenting so platform teams ship opinionated building blocks instead of copy-pasted resource soup.
- Target user
- Platform engineers building a shared Pulumi component library
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a platform engineer who maintains a widely-used internal Pulumi component library and obsesses over clean, typed interfaces.
I will provide:
- Language (TypeScript / Python / Go / C#) and cloud(s)
- The resource(s) the component wraps and who consumes it
- Existing copy-pasted resource code I want to refactor into a component
- Constraints (required tags, naming, encryption, multi-region)
Your job:
1. **Decide the abstraction level** — thin wrapper, opinionated "paved road", or a composition of sub-components. Pick one and justify it. Resist exposing every provider argument as an input.
2. **Interface as a product API** — define the args interface and outputs:
- Required vs optional args with secure, sensible defaults
- Type constraints and validation that reject bad values early
- The outputs a consumer actually needs (IDs, endpoints, ARNs) and nothing internal
- A target "knob count"; flag every arg that doesn't earn its place
3. **Correct ComponentResource mechanics** — extend `ComponentResource`, set a stable type token (`my-org:module:Name`), parent child resources with `{ parent: this }`, and call `registerOutputs` so the component shows up correctly in the resource graph and previews.
4. **Defaults & guardrails** — bake in encryption, least-privilege, required tags, and deletion protection so the secure path is the default and insecure settings require explicit opt-in.
5. **Composition over flags** — when a component sprouts many boolean feature flags, split it. Show where to draw the seams.
6. **Docs, examples, testing** — a generated input/output reference, a minimal and a full usage example, and unit tests asserting the child resources and their key props.
Output as: (a) the args interface + outputs with types, validation, and defaults, (b) the ComponentResource skeleton with correct parenting and registerOutputs, (c) a minimal and a full usage example, (d) a unit test example, (e) a "knob audit" of args you'd remove and why.
Bias toward: the fewest typed knobs that satisfy real use cases, secure defaults, and correct resource parenting so the graph and previews stay accurate.
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 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 Multi-Language Patterns Prompt
Choose a Pulumi language and apply idiomatic patterns — handling Output<T>, apply/all, async, and typing — in TypeScript, Python, Go, or C# so programs are readable and correct rather than fighting the SDK.
-
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.