How I should reuse an output from one resource?
# python
b
How I should reuse an output from one resource?
b
you need to do the
apply
before the
json.dumps
not inside it
b
this way?
b
no, it should be:
Copy code
pulumi.Output.all(source_arn=source_bucket.arn, output_arn=output_bucket.arn).apply(lambda args: json.dumps( ......
b
is there any easier way to work with the outputs of other resources? This sounds too much to remember always
this example looks easier 🤔
e
pulumi.json_dumps
should handle complex objects with nested output values
b
do you have some example?
e
No, I'm planning on updating some of the code in the examples repo to use it. But it is literally just the same as json.dumps except the value you pass in can contain Output values.
b
I'll try, thanks
😂
maybe this is in beta release or somehting?
e
hmm I thought this had been released already, one sec
b
image.png
e
Oh silly me.
It's on the output type, not a top level method. Output.json_dumps
b
like a charm, thankjs!!!!
g
@echoing-dinner-19531
pulumi.json_dumps
Is this a new method? I wrote a sketchy one myself because I was jealous of TS
pulumi.interpolate
e
It is a new method, was released just before Christmas holidays.
g
ooh! great work! This should solve a lot of headaches! Thanks a lot for this!