LinuxCommandLibrary

pulumi-stack

Manage Pulumi stacks

TLDR

Create a new stack

$ pulumi stack init [stack_name]
copy

Show the stack state along with resource URNs
$ pulumi stack [[-u|--show-urns]]
copy

List stacks in the current project
$ pulumi stack ls
copy

List stacks across all projects
$ pulumi stack ls [[-a|--all]]
copy

Select an active stack
$ pulumi stack select [stack_name]
copy

Delete a stack
$ pulumi stack rm [stack_name]
copy

Show stack outputs, including secrets, in plaintext
$ pulumi stack output --show-secrets
copy

Export the stack state to a JSON file
$ pulumi stack export --file [path/to/file.json]
copy

SYNOPSIS

pulumi stack [command]

PARAMETERS

init [stack-name]
    Create an empty stack with the given name. stack-name is optional.

rm [stack-name]
    Remove a stack and its configuration. stack-name is optional (defaults to current stack).

select [stack-name]
    Selects a stack to be active. stack-name is required.

ls
    Lists all stacks. Displays stack names, last update time, and current stack (marked with an asterisk).

export [path]
    Export stack configuration to a file. path is optional (defaults to stdout).

import [path]
    Import stack configuration from a file. path is optional (defaults to stdin).

rename [new-stack-name]
    Rename an existing stack to a new name. new-stack-name is required.

graph
    Display the stack graph in DOT format.

--help
    Show help for the stack command.

DESCRIPTION

The `pulumi stack` command provides a comprehensive interface for managing Pulumi stacks. A stack in Pulumi is an isolated, independently configurable environment for a Pulumi program. It allows you to deploy and manage your infrastructure in different contexts, such as development, staging, and production, all from the same codebase. This command encompasses operations like creating new stacks, selecting the active stack, listing existing stacks, exporting stack configuration, importing configuration, renaming, and removing stacks. It is a fundamental tool for Pulumi users to organize and control their infrastructure deployments. Different stacks can have different configurations, enabling you to customize your infrastructure for each environment. Furthermore, the `pulumi stack` command helps facilitate team collaboration and allows versioning and rollback capabilities.

CONFIGURATION

Stacks manage their configurations separately, allowing for different settings for each environment. You can use `pulumi config` commands to set and retrieve stack-specific configurations.

STACK NAMING

Stack names must be unique within a Pulumi project and organization. Consider using meaningful names that reflect the environment and purpose of the stack. Examples: `dev`, `staging`, `prod`, `my-feature-branch`.

Copied to clipboard