Hello. Couple of questions to get oriented. I am c...
# getting-started
m
Hello. Couple of questions to get oriented. I am coming from Terraform. I have configured pulumi to use gcp bucket backend. But it also creates a local stack.yaml file. Why is this necessary. Can it be configured not to use local stack configs alsways use the bucket backend files. ? If so, how? The main reason is, I have tenant specific pulumi configs and having local configs are not realistic
l
Do you mean
Pulumi.<stackname>.yaml
? That's not the state file, it's the config file for that stack. It's where you put value that discriminate between stacks, which might be things like the region you're deploying to or the URL of some 3rd party service something connects to.
It can be removed, or left empty. If all your configs are stored remotely, maybe in a vault, then it might just have the URL of the vault.
The config file is kept in the repo along with the other source code, it's not developer-specific. So generally it's useful, in most use cases.
m
Adding to this: The Terraform equivalent would be the
variable.<env>.tfvars
files. You can retrieve the latest configuration of a stack through the CLI via
pulumi config refresh
, which can be helpful when you dynamically create stack configurations in your CI workflows.
o
Hi, what does it mean to get the latest configuration of a stack? Does it mean printing the values from the
Pulumi.<stackname>.yaml
to the console?
m
pulumi config refresh
updates your
Pulumi.<stackname>.yaml
file based on the state. For example, if your CI workflow created a new stack
pr-123
and you now want to work with it, you can run
pulumi stack select pr-123
and then
pulumi config refresh
on your machine to get the config file.
It will hold the values that were used in the last deployment of the stack.
o
I was suspecting that but I wasn't sure. It's pulling the remote stack config to local config file. I guess that is only possible with Pulumi Cloud service. I don't this see this could work in my case where stack files are in AWS S3 and dynamic configuration set in CI/DC pipeline is lost anyway.
m
This works with a custom backend as well. The configuration is part of the state file, even when you set it dynamically.
💡 1
The only caveat is that it's the last deployed configuration. On AWS, you can store your configuration in SSM if you want to share stack configurations without deploying them.