https://pulumi.com logo
#general
Title
# general
l

limited-farmer-68874

06/17/2023, 1:28 AM
I would like to get a Pulumi secret value from my config and use it as a string in my code. Is that at all possible? I've been banging my head trying to figure out how to do this for hours.
apply
does not seem to convert
Output[str]
despite documentation and everyone on the internet saying this is the way to accomplish this... I'm working in Python, Btw.
In order to avoid the XY problem, I'll also say that what I'm trying to do is download a ZIP file from the internet as a
pulumi.FileAsset
, but the ZIP file requires some Authorization.
And to take it even a step further back -- REALLY what I want to do is initialize a GCP cloud function from a github repository
b

billowy-army-68599

06/17/2023, 1:54 AM
apply
does not seem to convert
Output[str]
Apply doesn’t convert an
Output[str]
it waits for the value to be returned, then does something with it. What do you have so far? You like want to do:
Copy code
value.apply(lambda v: //download the file here)
l

limited-farmer-68874

06/17/2023, 2:01 AM
brilliant, thank you!
that worked lovely
b

billowy-army-68599

06/17/2023, 2:10 AM
I updated the inputs and outputs doc yesterday, you may consider reading it and seeing if it’s easier to grok now https://www.pulumi.com/docs/concepts/inputs-outputs/
l

limited-farmer-68874

06/17/2023, 2:20 AM
thank you!
Is there a way to easily cleanup the downloaded file after Pulumi up runs?
b

billowy-army-68599

06/17/2023, 3:08 PM
No there’s no post run callback, I’d just download the file into a temporary directory tbh
l

limited-farmer-68874

06/19/2023, 2:31 AM
that's what I'm doing but still 😛 having init and cleanup hooks would be reaaaally nice
41 Views