Skip to content
Latchkey

pulumi stack: select, init, output & CI Errors

Manage the named stacks that hold each environment’s state.

pulumi stack manages stacks - independent instances of your program, each with its own state and config. In CI you select (or init) the right stack and read its outputs for downstream steps.

What it does

A stack is an isolated deployment of a Pulumi program with its own state and configuration (dev, staging, prod). stack init creates one, stack select makes it active, stack ls lists them, and stack output prints the exported outputs for use by other jobs.

Common usage

Terminal
# List stacks
pulumi stack ls

# Create and select a stack
pulumi stack init acme/staging
pulumi stack select acme/staging

# Read an output for a later CI step
URL=$(pulumi stack output apiUrl --stack acme/prod)

# Output a secret value (must opt in)
pulumi stack output dbPassword --show-secrets --stack acme/prod

Common error in CI: no stack selected / stack not found

Commands fail with "error: no stack selected; please use pulumi stack select" or "stack 'acme/prod' not found". The runner is in a fresh checkout with no active stack, or the stack was never created in this backend. Fix: pass --stack explicitly on every command (CI checkouts have no persisted selection), and create it with pulumi stack init <org>/<name> on first deploy. Ensure you are logged into the backend that actually holds the stack.

Key subcommands

SubcommandPurpose
init NAMECreate a new stack
select NAMEMake a stack active
lsList stacks
output [NAME]Print stack outputs
rm NAMERemove a stack
export / importDump or load stack state

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →