Author : MD TAREQ HASSAN | Updated : 2021/10/07

What is Stack in Pulumi?

Stack Naming

Default Stack
While creating new project with ‘pulumi new’ command, if you do not specify stack name, default stack name ‘dev’ will be selected.

Stack naming limitation when using local or cloud backend

Stack Configuration File

Creating Stack

#
# cd pulumi/project/root-folder (in which Pulumi.yaml file is located)
#
#
pulumi stack init <stackName>
pulumi stack init <projName>/dev-test
pulumi stack init <orgName>/pulumi-renshu/dev-test

Secrets Provider

pulumi stack init QA # pulumi.com backend


# local or cloud backend with passphrase (key) for Pulumi secrets
pulumi stack init QA --secrets-provider=passphrase 


# Azure blob container backend with Azure KeyVault key for Pulumi secrets
# pulumi login azblob://pulumi-backend-container
# pulumi stack init QA --secrets-provider="azurekeyvault://mykeyvaultname.vault.azure.net/keys/mykeyname"
pulumi stack init dev --secrets-provider="azurekeyvault://xxx-pulumibackend-kv.vault.azure.net/keys/pulumi-secret-key"

See: https://www.pulumi.com/docs/reference/cli/pulumi_stack_init/

Current Stack and Selecting Target Stack

Stack State

Satck State Backend

See Stack State Backend Details

Deploying Stack (Deploying a Project)

Listing Stacks

View Stack Resources

Use “pulumi stack” with no arguments

Stack Tags

Stack Outputs

https://www.pulumi.com/docs/intro/concepts/stack/#outputs

Removing Stack