This message was deleted.
# general
s
This message was deleted.
b
Hi @jolly-camera-35709 You will need to have a read of this section of the Programming model - https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs TL;DR, Outputs are like Promises and need to be resolved
j
Hi @broad-dog-22463, but the key and value in the config file is not an output, it is written in the config file in plain text, it doesn't need to be resolved.
b
Hi @jolly-camera-35709 “print” doesn’t understand this - the Pulumi engine needs to read the file and parse it so print only sees the type - require_secret is an Outout therefore needs to be resolved for debugging like print Had you used Pulumi.export then it would not give you the Output
j
Hi @broad-dog-22463 I read the doc of programming model, I still didn't get it. First of all, the doc says outputs are not fully known until the infrastructure resource has actually completed provisioning, which happens asynchronously, that makes sense if it's output of a resource, but reading a secret in config doesn't need to wait for any infra resource provision. If config.require_secret() has to be an Output object, it's fine, but why make it to use the same asynchoronous mechanism as resource output? You advise to use pulumi.export, how do you do that exactly? I thought the export value is for other stack to use, and the export value is also an Output object. I then tried apply, I did this "db_pwd=config.require_secret('db_pwd')" "print(db_pwd.apply(lambda db_pwd: db_pwd))", again I got <pulumi.output.Output object at 0x7f7e5965d9b0>
what I want to do is read the db pwd from pulumi config file and then set the 'password' param of the pymysql.connect function
I tried the following
connection = pymysql.connect(host=db_host, user=db_user, password=config.require_secret('db_pwd').apply(lambda db_pwd: db_pwd), database='mysql', cursorclass=pymysql.cursors.DictCursor)
but this doesn't work as the password from the apply function is still a Output object
how can it be so hard to read the value of the config item...it's frustrating