Author : MD TAREQ HASSAN | Updated : 2021/10/08
What is Stack State Backend
- A storage location where Pulumi stores Stack State data (state information of all stacks)
- Each stack in Pulumi has it’s own state file. Pulumi keeps this state file in a backend
- From Pulumi Doc: Pulumi stores state in a backend of your choosing. A backend is an API and storage endpoint used by the CLI to coordinate updates, and read and write stack state whenever appropriate
- State Backend can be any of followings:
- Pulumi Service
- AWS S3
- Microsoft Azure Blob Container
- Google Cloud Storage
- Local filesystem
By default
- Pulumi stores its infrastructure state file in json format by default inside the Pulumi service
- a stack created using the pulumi.com backend will use the pulumi.com secrets provider
- a stack created using the local or cloud object storage backend will use the passphrase secrets provider
A different secrets provider can be selected by passing the –secrets-provider flag
Azure Blob Storage as Stack State Backend
See: Using Azure blob storage as backend
Pulumi Service as Stack State Backend
- Managed Pulumi Service Backend: Pulumi Service provides State Backends services
- Self-Hosted Pulumi Service Backend:
- You take Pulumi Service docker images from private docker hub (ned enterprise license to get it)
- You host Pulumi Service by yourself
- Everything works the same as with the standard Pulumi Service, except that Pulumi will target your private instance
- ‘Pulumi Service’ account
- By default, Pulumi will use ‘Pulumi Service’ account as backend to store stack state information in ‘https://app.pulumi.com/
' - Stack state information can also be saved locally
- ‘Pulumi Service’ account is free for individual users
- By default, Pulumi will use ‘Pulumi Service’ account as backend to store stack state information in ‘https://app.pulumi.com/
- Login using default browser: https://app.pulumi.com/signin
- Stay logged in
pulumi new
: Pulumi CLI will promt you to login to backend- Hitting ENTER at the prompt opens up default web browser allowing you to sign in
Saving Stack State Locally
pulumi login --local # syntactic sugar for pulumi login file://~.
pulumi login file:///state/path
pulumi login # -> $ pulumi login https://api.pulumi.acmecorp.com
pulumi login --local # pulumi login file://~
#
# Azure Blob
#
pulumi login azblob://my-pulumi-state-bucket