Hello , Looking for an advice , I am trying pulumi...
# python
Hello , Looking for an advice , I am trying pulumi with python and would like to know the better usage of Output . • Creating a resources let say r = xx.CreateResources(…) ==> r (A pulumi output object) • Would like to extract the raw value of a property ,let say r.http_url (which is again a type of
pulumi.output.Output object
. • Would like to print these values via a print statement (like terraform output format) ,what is the best way to fetch the value via Ouput() method ?
hey @white-terabyte-21934 : Output usage is usually fairly clear, the values are asynchronously retrieved. You should try to avoid creating resources after resolving an output yourself (ie, when using
) because previews won't be accurate. if you want to extract the resolved property of an output (what you call raw) you would use an
if you want to just print them, again, just use an apply. if you want to print them to console, use
🙌 1
If i may ask ,do you have a sample snippet to see how to get the value with out lambda , • What i am trying to do is ,using radmon string , get a random value and use the value as a prefix for pulumi and non pulumi actions , for pulumi resources its more easy that i can use radmon.result as is ,but for others its not getting around .
Copy code
print (f"xxx_{random_string().result") ==> Would want to use the value as raw , not with in a lambda with a function return or an assigned variable than can parse to next function or class object calls
i got it working using an external file write or OS.env but any other better way ?
You can only do this inside an apply. What are you trying to pass the value to?
i am parsing as a uniq ref to resource that are created by pulumi as well as reference to some other local updates (outside of pulumi control) • like OCI code repo (under pulumi) • pygit remote ref - for a specific external python actions ,but to refer under the same commit message /id