pulumi-best-practices

Installation
Summary

Comprehensive best practices for writing reliable, maintainable Pulumi infrastructure code.

  • Avoid creating resources inside apply() callbacks; pass Output objects directly as inputs to preserve dependency tracking and preview visibility
  • Use ComponentResource classes to group related resources into reusable logical units with proper parent-child hierarchy via parent: this
  • Encrypt secrets from the start with --secret flag or config.requireSecret() to prevent credential leakage in state files and logs
  • Add aliases during refactoring to preserve resource identity when renaming, moving into components, or changing parents, preventing unnecessary destroy-recreate cycles
  • Always run pulumi preview before deployment to catch unexpected resource replacements, deletions, or ordering issues
SKILL.md

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:

Related skills

More from pulumi/agent-skills

Installs
1.1K
GitHub Stars
45
First Seen
Jan 28, 2026