pulumi-best-practices

Reviews and writes Pulumi infrastructure code following Output handling, components, secrets, and aliasing practices.

Updated Apr 30, 2026
One-click install
npx skills add https://github.com/AdityaBorkar/igbot-fork --skill pulumi-best-practices-adityaborkar
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: pulumi-best-practices
Source: https://github.com/AdityaBorkar/igbot-fork/tree/main/.agents/skills/pulumi-best-practices
Command: npx skills add https://github.com/AdityaBorkar/igbot-fork --skill pulumi-best-practices-adityaborkar

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Pulumi programs often fail in subtle ways: resources created inside apply() callbacks disappear from previews, refactored resources get destroyed and recreated, and plaintext secrets leak into state files. This Skill provides a structured set of practices to write, review, and refactor Pulumi infrastructure code correctly. ## Core Features & Use Cases - Output and Dependency Handling: Enforces passing Outputs directly as inputs, using pulumi.interpolate instead of manual unwrapping, and never creating resources inside apply() callbacks. - Component Structure: Guides grouping related resources into ComponentResource classes with parent: this set on all children for correct hierarchy and state management. - Secrets and Safe Refactoring: Covers encrypting secrets with --secret flags and Pulumi ESC from day one, plus using aliases to preserve resource identity during renames and moves. - Deployment Safety: Requires pulumi preview before every deployment, with CI/CD integration patterns for GitHub Actions. - Use Case: When reviewing a teammate's Pulumi pull request that renames an S3 bucket and moves it into a component, use this Skill to verify aliases are present so the bucket is not destroyed and recreated in production. ## Quick Start Review my Pulumi TypeScript program for best practice violations and suggest fixes for any issues found.

Frequently Asked Questions about pulumi-best-practices

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I pass Pulumi Output values between resources?▼

Pass Output values directly as resource inputs so Pulumi tracks the dependency in its graph. For string interpolation, use pulumi.interpolate or pulumi.concat instead of extracting values with apply(), which breaks the dependency chain.

Why do resources created inside apply() not appear in pulumi preview?▼

Resources created inside apply() callbacks only exist after the Output resolves at deployment time, so Pulumi cannot include them in the preview graph. Move resource creation to the top level and pass Outputs directly as inputs instead.

How do I rename a Pulumi resource without destroying it?▼

Add an aliases option with the old resource name when renaming, for example aliases: [{ name: "old-name" }]. When moving a resource into a component, also include the old parent in the alias so Pulumi preserves the existing resource identity.

How do I store secrets securely in Pulumi config?▼

Set secrets with pulumi config set --secret so values are encrypted in state files and masked in CLI output. In code, retrieve them with config.requireSecret(), and use Pulumi ESC environments to manage secrets centrally across stacks.

What does parent: this do in a Pulumi ComponentResource?▼

Setting parent: this on child resources nests them under the component in the Pulumi console and state file. It ensures deleting the component deletes its children and that aliases on the component apply to all children.

Why does pulumi preview show replace instead of update?▼

A replace operation means an immutable property changed, forcing Pulumi to destroy and recreate the resource. Review the diff for changed immutable fields, and check for missing aliases if the replacement follows a rename or refactor.