
Pulumi Component
Author reusable Pulumi ComponentResource classes so cloud stacks stay readable, shareable, and multi-language friendly.
Overview
pulumi-component is an agent skill most often used in Build (also Operate) that guides authoring Pulumi ComponentResource classes for reusable, nested infrastructure packages.
Install
npx skills add https://github.com/pulumi/agent-skills --skill pulumi-componentWhat is this skill?
- Covers full component lifecycle: class anatomy, args design, outputs, and registerOutputs
- Requires parent: this on child resources so preview/up trees nest correctly
- Guidance for multi-language consumption and publishing component packages
- Debugging paths for missing outputs, stuck creating, and wrong nesting level
- Pairs with pulumi-best-practices for general Output/secrets/alias patterns
- Documents four required component elements: extend ComponentResource, standard params, parent: this, registerOutputs()
- Skill version 1.0.0 in frontmatter
Adoption & trust: 794 installs on skills.sh; 56 GitHub stars; 2/3 security scanners passed (skills.sh audits).
What problem does it solve?
Your Pulumi stacks are a flat sprawl of resources that nobody can reuse, preview clearly, or publish as a shared package.
Who is it for?
Indie developers refactoring duplicated cloud resources into one component library before scaling environments or handoffs.
Skip if: One-off throwaway stacks with no reuse goal, or teams that only need generic Pulumi coding tips without component structure.
When should I use this skill?
Creating a new ComponentResource class, designing component args, enabling multi-language consumption, publishing a component package, or refactoring inline resources into a component.
What do I get? / Deliverables
You ship ComponentResource classes with correct parenting and registered outputs, ready to preview as single nodes and distribute across languages.
- ComponentResource subclass with type URN and registered outputs
- Args interface and ComponentResourceOptions usage pattern
- Package layout suitable for internal or public distribution
Recommended Skills
Journey fit
Spans multiple journey phases - primary shelf plus alternate fits below.
Build is the canonical shelf because you define and package components while shaping the product’s infrastructure—not only after production incidents. Integrations captures wiring cloud resources into a composable API your app and agents consume via Pulumi programs.
Where it fits
Wrap S3 + CloudFront + IAM into one ComponentResource for every microsite you ship.
Fix children appearing at stack root because parent: this was omitted on a nested resource.
Preview a release stack where components collapse noisy resource lists into one node per service.
Sketch a minimal component API in a hackathon stack before promoting it to a shared package.
How it compares
Use for ComponentResource authoring; pair with pulumi-best-practices for general IaC patterns, not as a Terraform module guide.
Common Questions / FAQ
Who is pulumi-component for?
Solo builders and small teams using Pulumi who want reusable infrastructure components with correct preview nesting and optional multi-language packages.
When should I use pulumi-component?
Use it during Build/integrations when creating or publishing components, and during Operate/infra when debugging component outputs or child resource hierarchy.
Is pulumi-component safe to install?
It is documentation-style procedural knowledge; still review the Security Audits panel on this page before installing skills from unknown publishers.
SKILL.md
READMESKILL.md - Pulumi Component
# Authoring Pulumi Components A ComponentResource groups related infrastructure resources into a reusable, logical unit. Components make infrastructure easier to understand, reuse, and maintain. Components appear as a single node with children nested underneath in `pulumi preview`/`pulumi up` output and in the Pulumi Cloud console. This skill covers the full component authoring lifecycle. For general Pulumi coding patterns (Output handling, secrets, aliases, preview workflows), use the `pulumi-best-practices` skill instead. ## When to Use This Skill Invoke this skill when: - Creating a new ComponentResource class - Designing the args interface for a component - Making a component consumable from multiple Pulumi languages - Publishing or distributing a component package - Refactoring inline resources into a reusable component - Debugging component behavior (missing outputs, stuck creating, children at wrong level) ## Component Anatomy Every component has four required elements: 1. **Extend ComponentResource** and call `super()` with a type URN 2. **Accept standard parameters**: name, args, and `ComponentResourceOptions` 3. **Set `parent: this`** on all child resources 4. **Call `registerOutputs()`** at the end of the constructor ### TypeScript ```typescript import * as pulumi from "@pulumi/pulumi"; import * as aws from "@pulumi/aws"; interface StaticSiteArgs { indexDocument?: pulumi.Input<string>; errorDocument?: pulumi.Input<string>; } class StaticSite extends pulumi.ComponentResource { public readonly bucketName: pulumi.Output<string>; public readonly websiteUrl: pulumi.Output<string>; constructor(name: string, args: StaticSiteArgs, opts?: pulumi.ComponentResourceOptions) { // 1. Call super with type URN: <package>:<module>:<type> super("myorg:index:StaticSite", name, {}, opts); // 2. Create child resources with parent: this const bucket = new aws.s3.Bucket(`${name}-bucket`, {}, { parent: this }); const website = new aws.s3.BucketWebsiteConfigurationV2(`${name}-website`, { bucket: bucket.id, indexDocument: { suffix: args.indexDocument ?? "index.html" }, errorDocument: { key: args.errorDocument ?? "error.html" }, }, { parent: this }); // 3. Expose outputs as class properties this.bucketName = bucket.id; this.websiteUrl = website.websiteEndpoint; // 4. Register outputs -- always the last line this.registerOutputs({ bucketName: this.bucketName, websiteUrl: this.websiteUrl, }); } } // Usage const site = new StaticSite("marketing", { indexDocument: "index.html", }); export const url = site.websiteUrl; ``` ### Python ```python import pulumi import pulumi_aws as aws class StaticSiteArgs: def __init__(self, index_document: pulumi.Input[str] = "index.html", error_document: pulumi.Input[str] = "error.html"): self.index_document = index_document self.error_document = error_document class StaticSite(pulumi.ComponentResource): bucket_name: pulumi.Output[str] website_url: pulumi.Output[str] def __init__(self, name: str, args: StaticSiteArgs, opts: pulumi.ResourceOptions = None): super().__init__("myorg:index:StaticSite", name, None, opts) bucket = aws.s3.Bucket(f"{name}-bucket", opts=pulumi.ResourceOptions(parent=self)) website = aws.s3.BucketWebsiteConfigurationV2(f"{name}-website", bucket=bucket.id, index_document=aws.s3.BucketWebsiteConfigurationV2IndexDocumentArgs( suffix=args.index_document, ),