:wave: - Hello everyone! I have a question regar...
# general
a
👋 - Hello everyone! I have a question regarding configuration for stacks... I noticed that when I make a stack, a
yaml
file is created for it in my project. I generally don't like to keep environment specific information in source control. Is there any other way to manage stack configurations in pulumi?
b
no there is not. can you elaborate on what you'd like to do instead?
a
Ideally just keep the environment configs somewhere separate, or optionally sometimes provide a subset of them from command line.
In theory, I could use pulumi to manage something like Google Cloud Run revisions.
But if I'm setting up a CD/release (Azure Devops/Octopus, etc...) job to do this, I'd like it to be able to specify what container to use, vs. always having to commit to a repo.
p
Considering pulumi relies on normal programming language, you can simply read these values from environment variables, e.g. in python you can simply write:
Copy code
import os

my_env_name = os.environ.get("MY_ENV_NAME")
However, keep in mind that by default stack config values are designed to be declared in yaml files so they can be checked in to your repo. That’s the whole idea behind infrastructure as code and gitops so you can easily revert to the previous state using git operations (such as revert). Of course, there are some cases where it might be unnecessary or even undesirable. In such cases, you can read those values from other sources (env variables, different files or external sources).
👍 1
a
Yeah, I don't necessarily take IaC to mean "put environment specific config" in source control.
IaC to me is just defining the shape of what could be using code.
But yeah, I totally forgot, it'd just be C# (in my case) at that point. I could use the .NET core configuration system too potentially.