sparse-intern-71089
02/13/2020, 7:19 PMwhite-balloon-205
pulumi.export
is to make it available outside of Pulumi. You can pulumi stack output
to get all outputs or pulumi stack output NodeName
to get just that one.
From within the program, you can print an output with:
node.apply(lambda n: print(n))
or just node.apply(print)
Note that those will only print the value once it is available.careful-market-30508
02/13/2020, 7:58 PMwhite-balloon-205
def myfunc(n):
and then write code within that function that does whatever you want, and call node.apply(myfunc)
.
See https://www.pulumi.com/docs/intro/concepts/programming-model/#outputs for much more detail on this.careful-market-30508
02/13/2020, 8:07 PMh = str
def myfunc(n):
h = n
node.apply(myfunc)
print ( "h = {}".format(h)) # prints h = <class 'str'>
white-balloon-205
def myfunc(n):
print ( "n = {}".format(n))
node.apply(myfunc)
If your real example is something different than this - please share it and I can suggest how to structure in Pulumi.