If you are using the default not configured local ...
# automation-api
l
If you are using the default not configured local workspace and inline programs, where is the "state" (aka list of stacks) stored. (Curious how to make something truly stateless to run on kubernetes for example)
Copy code
auto.LocalWorkspace()
AKA if two instances of a Flask app similar to https://github.com/komalali/self-service-platyform were deployed on AKS and called the GET "/" route they would display different lists of stacks right?
r
they would display different lists of stacks right?
Nah, the stacks are stored in the pulumi service, so they would show the same list of stacks.
Also why your list of stacks persists even when you shut down and restart the flask app
l
ok, i wasn't sure if under the hood the "local" workspace was persisting something locally
thanks
👍🏽 1
r
LocalWorkspace is named as such because it depends on being able to store things like config and the project file locally before being able to execute a program. But when using inline programs like that app does, it’ll write all that into a temp directory just to allow executing the program.
l
Gotcha, so the only thing that matters then is that the pulumi token/credentials has access to the stack(s)
💯 1
not where it was originally spawned
l
Notable exception is config. If you select a stack from a local workspace and the stack yaml file isn't present, then there is no config on the stack. You have two options: 1. run a
refreshConfig
before the update to pull the last applied config from the pulumi service 2. always set all required config values on each update
l
can you clarify what you mean by config in this context, the config I'm thinking of is the ENV variables my flask app is pulling in
but that's independent of anything pulumi related
b
He means pulumi config. Meaning your
pulumi.stackName.yaml
files and everything manipulated via
pulumi config
in CLI
👍 1
b
I hope it’s OK to ask a follow up question here - is it possible to change the backend state storage for LocalWorkspace? e.g. to tell it to store in S3 rather than the Pulumi service? I wasn’t sure if it was as simple as setting Project.Backend (https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3@v3.2.1/go/common/workspace#Project) and then invoking https://pkg.go.dev/github.com/pulumi/pulumi/sdk/v3/go/auto#LocalWorkspace.SaveProjectSettings
l
I believe you can also control this via an environment variable (specified to the process or workspace) `PULUMI_BACKEND_URL`https://www.pulumi.com/docs/reference/cli/environment-variables/
b
Thanks @lemon-agent-27707 ! I tried a few of the examples to see if I could find it but there’s so many 😀 If I wanted to use the S3 backend I imagine it’s just setting the url to S3?
l
Yes I believe you can substitute the URLs used for login outlined here: https://www.pulumi.com/docs/intro/concepts/state/
I tried a few of the examples to see if I could find it but there’s so many 😀
Too many examples! I have not heard that one before 😆
b
First time for everything 🙃