https://pulumi.com logo
#automation-api
Title
# automation-api
l

little-orange-65618

05/05/2021, 12:42 AM
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

red-match-15116

05/05/2021, 12:46 AM
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

little-orange-65618

05/05/2021, 12:47 AM
ok, i wasn't sure if under the hood the "local" workspace was persisting something locally
thanks
👍🏽 1
r

red-match-15116

05/05/2021, 12:49 AM
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

little-orange-65618

05/05/2021, 12:50 AM
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

lemon-agent-27707

05/05/2021, 2:01 AM
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

little-orange-65618

05/05/2021, 8:39 AM
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

bored-oyster-3147

05/05/2021, 12:36 PM
He means pulumi config. Meaning your
pulumi.stackName.yaml
files and everything manipulated via
pulumi config
in CLI
👍 1
b

bored-table-20691

05/15/2021, 12:41 AM
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

lemon-agent-27707

05/15/2021, 12:49 AM
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

bored-table-20691

05/15/2021, 1:04 AM
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

lemon-agent-27707

05/15/2021, 6:35 AM
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

bored-table-20691

05/15/2021, 6:37 AM
First time for everything 🙃