There is, but you probably shouldn't use it. You can use the
apply()
method on the output, which takes a function as a parameter, and the password value will be available inside that function (but not at the top level).
little-cartoon-10569
06/20/2022, 9:02 PM
However, this is rarely necessary. Can you explain or show in code how you want to use this password? Generally, you can pass the output value into other Pulumi resources, and let them handle the extraction of the string from the output.
s
stale-iron-26898
06/21/2022, 10:50 AM
Hi @little-cartoon-10569, I want to use a random password resource with pulumi and send it as string to other function that should read this and put in file
I tried to use with apply but unfortunately none of the tries succeed. do you able to solve any kind of this similar issue?
l
little-cartoon-10569
06/21/2022, 7:47 PM
You cannot pass it as a string to another function, except from within an apply. And ideally you should not do that. What sort of function takes the password parameter? If it is a Pulumi constructor, you don't need a string, the output will do fine. If it is anything else, you should either change it (to be a Pulumi constructor), or use an apply.
There are many examples of using apply, in the documentation and in the examples repo (https://github.com/Pulumi/examples).
No matter how you like to participate in developer communities, Pulumi wants to meet you there. If you want to meet other Pulumi users to share use-cases and best practices, contribute code or documentation, see us at an event, or just tell a story about something cool you did with Pulumi, you are part of our community.