Hi folks. What's the right way to pass input param...
# general
p
Hi folks. What's the right way to pass input parameters into a Pulumi program when executing it in a CI/CD context? I.e. values that should be used in one way or another by the Pulumi program in
preview
and
update
operations, but which are not config values stored in the stack but rather set and known by the release job on a per-release basis.
I'm guessing this parameter might be relevant:
-c, --config stringArray       Config to use during the update
But that seems to exist only on
update
and not on
preview
.
More specifically in this case, what I'm trying to accomplish is using a Pulumi program to deploy an Azure App Service based on Linux containers. I'm looking to execute this program from an Azure DevOps release pipeline, to deploy it to a particular stack. The container image to be run on the App Service is built in a separate job, where Pulumi is not involved. The image tag that should be pulled and run by the App Service is determined and known by the release job, and needs to be passed down to Pulumi and used as one of the arguments set on the App Service.
m
I think that an environment variable is a reasonable solution here. Is there a reason that you can't do something like
pulumi config set ... && pulumi update
, though?
p
Hm, environment variable could be a way. How do I read those from within the Pulumi program?
pulumi config set
just seems wrong, because this value is really not configuration that I'd like persisted in the stack. The value is by nature more of a parameter than a configuration value - if that makes sense?
m
Yes, that makes sense.
Are you using Typescript/Javascript or Python?
In the former case, you can use the
env
property of the Node.JS
process
object:
process.env["MYENVVAR"]
in the latter case, you can use `os.environ`:
Copy code
import os
print(os.environ["MYENVVAR"])
p
TypeScript, so the former should be a viable option. Thanks! 👍