pulumi avatar

Pulumi Best Practices

Practice-based guide for Pulumi TypeScript and Python programs covering outputs, components, parenting, and secrets.

skills.sh installs
2.7K
GitHub stars
80
last updated
Aug 21, 2026
View on GitHub

Own this skill? Claim it

What it does

  • Covers five practices for writing and reviewing Pulumi programs, including output handling, component design, and resource hierarchy
  • Includes wrong-versus-right code examples for apply() misuse, direct output passing, pulumi.interpolate, and ComponentResource classes
  • Enforces that resources are never created inside apply() and that child resources in components set parent: this
  • Designed for developers writing, refactoring, or debugging Pulumi infrastructure code and configuring secrets or CI workflows

Install

$ npx -y skills add pulumi/agent-skills --skill pulumi-best-practices -y

Installs into .agents/skills for every agent it finds here, and .claude/skills for Claude Code.

Files

Pulumi Best Practices

When to Use This Skill

Invoke this skill when:

  • Writing new Pulumi programs or components
  • Reviewing Pulumi code for correctness
  • Refactoring existing Pulumi infrastructure
  • Debugging resource dependency issues
  • Setting up configuration and secrets

Practices

1. Never Create Resources Inside apply()

Why: Resources created inside apply() don't appear in pulumi preview, making changes unpredictable. Pulumi cannot properly track dependencies, leading to race conditions and deployment failures.

Detection signals:

  • new aws. or other resource constructors inside .apply() callbacks
  • Resource creation inside pulumi.all([...]).apply()
  • Dynamic resource counts determined at runtime inside apply

Wrong:

const bucket = new aws.s3.Bucket("bucket");

bucket.id.apply(bucketId => {
    // WRONG: This resource won't appear in preview
    new aws.s3.BucketObject("object", {
        bucket: bucketId,
        content: "hello",
    });
});

Right:

const bucket = new aws.s3.Bucket("bucket");

Details

Repository
github.com/pulumi/agent-skills
Categories
DevOps & Cloud, Backend & APIs

More from pulumi/agent-skills

All 12

Similar to Pulumi Best Practices

More DevOps & Cloud