- Home
- Skills
- Pulumi
- Agent Skills
- Pulumi Component
pulumi-component_skill
25
GitHub Stars
1
Bundled Files
2 months ago
Catalog Refreshed
4 months ago
First Indexed
Readme & install
Copy the install command, review bundled files from the catalogue, and read any extended description pulled from the listing source.
Installation
Preview and clipboard use veilstrat where the catalogue uses aiagentskills.
npx veilstrat add skill pulumi/agent-skills --skill pulumi-component- SKILL.md26.6 KB
Overview
This skill is a practical guide for authoring Pulumi ComponentResource classes to create reusable infrastructure building blocks. It explains required component anatomy, args design, output exposure, and patterns for multi-language compatibility and package distribution. The goal is predictable, reusable components that integrate cleanly into Pulumi projects and SDKs.
How this skill works
The skill walks through the four required component steps: extend ComponentResource and call super() with a type URN, accept standard parameters (name, args, opts), set parent: this on child resources, and call registerOutputs() at the end. It shows TypeScript and Python examples, explains URN format, and highlights common pitfalls that leave components stuck in creating state. It also covers designing args (Input<T>, flat shapes, no unions/functions), exposing minimal outputs, defaults, conditional children, and multi-language concerns.
When to use it
- When creating a new reusable ComponentResource class for your infrastructure.
- When designing the args interface to be multi-language friendly and composable.
- When refactoring inline resources into a named component with clear outputs.
- When preparing a component for publishing or multi-language SDK generation.
- When debugging components (stuck creating, missing outputs, child hierarchy issues).
Best practices
- Call super() with a proper type URN: <package>:<module>:<type> and registerOutputs() as the last step.
- Use pulumi.Input<T> for args so consumers can pass raw values or Outputs.
- Keep args flat, avoid union types and functions to support multi-language SDKs.
- Derive child resource names from the component name to avoid collisions.
- Expose only the minimal outputs consumers need and compute composite outputs with interpolate/concat.
Example use cases
- Build a SecureBucket component that enforces encryption, versioning, and public access block with sensible defaults.
- Compose a StaticSite component that creates a bucket and website configuration and exposes url and bucketName.
- Create a Database component that returns endpoint, port, and securityGroupId without exposing internal resources.
- Add optional monitoring and alarms via boolean args to conditionally create sub-resources.
- Publish a component package that targets multiple Pulumi languages by avoiding unions and callbacks.
FAQ
The component may appear stuck in a creating state and outputs will not be persisted to state; always call registerOutputs() at the end of the constructor.
Why use pulumi.Input<T> in args?
Input<T> accepts plain values and resource Outputs, so consumers can pass dynamic values without manual .apply() unwrapping.
How do I support multiple Pulumi languages?
Avoid union types, functions, and deeply nested structures; prefer flat interfaces with Input<T> and explicit optional properties.