https://pulumi.com logo
#getting-started
Title
# getting-started
s

shy-dentist-79386

07/20/2022, 3:02 AM
Hi, can we set config from code?? I found Config.get but didn’t see Config.set
l

little-cartoon-10569

07/20/2022, 3:35 AM
Config is for changing the way the code works. Config.set would amount to self-modifying code.
No, there is no Config.set. Config is read-only within the context of a Pulumi program.
s

shy-dentist-79386

07/20/2022, 3:53 AM
ok. I want to store variables to a stack. How can I do it??
l

little-cartoon-10569

07/20/2022, 3:54 AM
Export is as an output.
I suppose it depends on the context. Where do you want to be able to retrieve this value?
s

shy-dentist-79386

07/20/2022, 3:57 AM
I am provisioning postgres. I put table definitions in a folder: 00-initialize.sql 01-update1.sql 02-update2.sql and execute them from code.
I want to store the number such as 02. so when next time I run pulumi up if I see a new file 03-xxx.sql 04-xxx.sql I will execute them
otherwise I will skip files already excuted.
l

little-cartoon-10569

07/20/2022, 4:00 AM
No, that's not what Pulumi is for.
You can do it in a Pulumi program, but you've got to write that sort of code yourself.
If you want to store it, you can either manually set it in your config, or write it to a vault or similar.
But ideally, you would use a different tool/library to do that, one better suited to the job.
s

shy-dentist-79386

07/20/2022, 4:02 AM
oh, I c.
did “vault” here mean something like aws.appconfig ?
l

little-cartoon-10569

07/20/2022, 4:10 AM
Like SSM Parameters, Hashicorp Vault, or any other persistent cloud-based store for values.
Could even use DynamoDB I guess..
s

shy-dentist-79386

07/20/2022, 5:03 AM
gotch. I will check them. Thank you so much!!!
5 Views