| name | pulumi-cli |
| description | Use for hands-on Pulumi CLI work: running deployments, fixing broken stacks, and managing infrastructure state. Handles: recovering from stuck or interrupted `pulumi up` with pending operations, cleaning orphaned resources from state after out-of-band cloud deletions, protecting critical resources from accidental `pulumi destroy`, moving resources between stacks without recreating them, targeting specific resources during deployment, migrating between backends (local file to Pulumi Cloud, S3), stack lifecycle management, state export/import/repair, CI/CD pipeline setup, and importing existing cloud resources. Use this skill — not the language-specific Pulumi skills — whenever the user's question is about operating, troubleshooting, or recovering Pulumi infrastructure rather than writing program code. |
Pulumi CLI Skill
Quick Command Reference
Deployment Workflow
pulumi new typescript
pulumi new aws-typescript --name myapp --stack dev --yes
pulumi preview
pulumi preview --diff
pulumi up
pulumi up --yes
pulumi up --skip-preview --yes
pulumi stack output
pulumi stack output --json
pulumi destroy --yes
Stack Management
pulumi stack ls
pulumi stack init dev
pulumi stack select prod
pulumi stack
pulumi stack history
pulumi stack output
pulumi stack output bucketName --show-secrets
pulumi stack rm dev --yes
State Operations
pulumi refresh --yes
pulumi stack export --file backup.json
pulumi stack import --file backup.json
pulumi state delete 'urn:pulumi:dev::myproject::aws:s3/bucket:Bucket::my-bucket'
pulumi state move --source dev --dest prod 'urn:...'
pulumi state protect 'urn:...'
Configuration
pulumi config set aws:region us-west-2
pulumi config set dbPassword secret --secret
pulumi config get aws:region
pulumi config
pulumi config env add myorg/myproject-dev
Common Flags
| Flag | Description |
|---|
--yes / -y | Skip confirmation prompts |
--stack / -s | Specify stack name |
--parallel / -p | Limit concurrent operations |
--target | Target specific resource URNs |
--refresh | Refresh state before operation |
--diff | Show detailed diff |
--json | Output in JSON format |
--skip-preview | Skip preview step |
--suppress-outputs | Hide stack outputs |
CI/CD Quick Setup
These three environment variables are essential for non-interactive Pulumi in CI/CD — without PULUMI_CI=true, Pulumi may prompt for input and hang your pipeline:
export PULUMI_ACCESS_TOKEN=pul-xxx
export PULUMI_CI=true
export PULUMI_SKIP_UPDATE_CHECK=true
pulumi login
pulumi stack select prod
pulumi preview
pulumi up --yes
Importing Existing Resources
pulumi import aws:s3/bucket:Bucket my-bucket existing-bucket-name
pulumi import --file resources.json
resources.json format:
{
"resources": [
{"type": "aws:s3/bucket:Bucket", "name": "my-bucket", "id": "existing-bucket-name"}
]
}
State Recovery Patterns
Resource deleted outside Pulumi
pulumi refresh --yes
pulumi state delete 'urn:pulumi:dev::myproject::aws:s3/bucket:Bucket::deleted-bucket'
Stuck pending operations
pulumi refresh --clear-pending-creates --yes
pulumi cancel --yes
pulumi state repair
State corruption
pulumi stack export --file current.json
pulumi state repair
pulumi stack export --version <previous-version> --file good.json
pulumi stack import --file good.json
URN Format
urn:pulumi:<stack>::<project>::<type>::<name>
Example:
urn:pulumi:dev::myproject::aws:s3/bucket:Bucket::my-bucket
Backend Options
pulumi login
pulumi login s3://my-bucket
pulumi login azblob://my-container
pulumi login gs://my-bucket
pulumi login file://~/.pulumi-state
References