This message was deleted.
# azure
s
This message was deleted.
s
If I’m understanding correctly (in that you want to be able to run
pulumi up
and have the results be dependent on user input), you have two options: 1. Write your code to pull environment variables and then use environment variables on the command line (i.e.,
VARIABLE=value pulumi up
). 2. Switch to using configuration values and have users supply the values they want to use via
pulumi config set
. Then each user can deploy their own stack with their own configuration values. The second is probably a “better” way of handling it but it is slightly different than the current way (again, if I’m understanding correctly).
m
Thank you for the reply and sorry for the delayed response. I tried finding documentation for the second option, but I am very much out of my depth when it comes to both Pulumi and PowerShell. I will keep searching and testing and see if I can find something that works. Thank you for the push in the right direction.
s
What language are you using? I can most likely find (or write) sample code that might illustrate the second approach.
m
I am writing the Pulumi scripts in TypeScript. Thank you so much for your time!
s
Of course, I am happy to help! Here’s a public example of how to pull a value from project configuration: https://github.com/pulumi/zephyr-infra/blob/main/index.ts#L4-L6 AIUI, in your case you’d want to take all those
Params
from the top of your PowerShell script and set them as configuration values. In TypeScript, the
|| <value>
syntax is a way of saying “If no other value was supplied, then use this value` (set a default, in other words). I don’t know if any of the parameters in your PowerShell script could have default values, but if you want/need to use defaults that’s how. Let me (or anyone else here) know if you have further questions.
m
If this were to be launched in a pipeline (they are using Azure classic pipelines today), would it be best to re-use the existing ps1 scripts and use the existing variables to inject Pulumi config into a pipeline-provided Pulumi environment from the scripts themselves, or would it be better to do everything config related in the pipeline in a "hard config way"? I would like there to be as little manual config for them to do in the end, where they only input the arguments they actually need for their specific resource (which, from my understanding, is how they are running it today, just without Pulumi). Essentially I think what I am asking is: Is rewriting the ps1 files for Pulumi config and letting them keep using that as an entry point for their infra a good way to also configure the Pulimi envs?
s
I would say that if updating the
.ps1
scripts to set Pulumi configuration values and run a Pulumi deployment works for you and your team, then go for it. I’m sure someone somewhere will say it’s not “correct” or the “most effective” way to do it, but if it works for you all, then it seems to me to be a perfectly reasonable starting point.