# general


09/19/2023, 1:43 PM
Hey folks, I have question regarding the
config file: I understand that it's used to keep configs about the environment, name of the project etc.. and at the same time to set configs that are not dependant on the stack. However, regarding the 2nd part, I am wondering: isn't it just the same as creating a
file and just setting global variables there? What is the advantage of setting them in


09/19/2023, 8:07 PM
Yes, you can set your variables any way you like, and access them from your code accordingly. Many Pulumi features are just Pulumi-specific solutions which you can implement in a different way. An advantage to using the project-wide variables is that a single API (and indeed, a single config object) can be used to to get all those values. If you used env vars or any other solution, you'd have to know which variables are accessed from Pulumi config, and which from those other places.
It also means that if your project-wide value becomes stack-specific in the future, you don't need to re-implement anything. Just remove the value from the Pulumi.yaml file, and put it in all your Pulumi.stack.yaml files.


09/20/2023, 9:32 AM
yeah fair enough, thanks for the explanation @little-cartoon-10569. Usually what I do is create a
file anyway, where I load all the pulumi configs there, and then import them in separate pulumi modules as needed. So I only have to write once
configs = pulumi.Config()


09/20/2023, 10:02 AM
From top of my head: • Stack config is used to parametrize [otherwise similar] deployments. • Values in Pulumi.yml provide defaults for stack config when they are not specified per stack but are required. It also serves as a documentation describing which values to expect. • Stack config can contain secrets • Stack config is a serializable in Key-Value and can round-trip between different languages. This is important if you use Pulumi automation with different languages. • YAML language can't use
. • Config can be queried by providers (which run in a different process)