https://pulumi.com logo
Title
b

bland-pharmacist-96854

01/17/2023, 3:00 PM
How I should reuse an output from one resource?
b

billowy-army-68599

01/17/2023, 3:02 PM
you need to do the
apply
before the
json.dumps
not inside it
b

bland-pharmacist-96854

01/17/2023, 3:03 PM
this way?
b

billowy-army-68599

01/17/2023, 3:06 PM
no, it should be:
pulumi.Output.all(source_arn=source_bucket.arn, output_arn=output_bucket.arn).apply(lambda args: json.dumps( ......
b

bland-pharmacist-96854

01/17/2023, 3:07 PM
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

echoing-dinner-19531

01/17/2023, 3:09 PM
pulumi.json_dumps
should handle complex objects with nested output values
b

bland-pharmacist-96854

01/17/2023, 3:10 PM
do you have some example?
e

echoing-dinner-19531

01/17/2023, 3:11 PM
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

bland-pharmacist-96854

01/17/2023, 3:11 PM
I'll try, thanks
😂
maybe this is in beta release or somehting?
e

echoing-dinner-19531

01/17/2023, 3:13 PM
hmm I thought this had been released already, one sec
b

bland-pharmacist-96854

01/17/2023, 3:13 PM
image.png
e

echoing-dinner-19531

01/17/2023, 3:14 PM
Oh silly me.
It's on the output type, not a top level method. Output.json_dumps
b

bland-pharmacist-96854

01/17/2023, 3:18 PM
like a charm, thankjs!!!!
g

great-sunset-355

01/18/2023, 3:31 PM
@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

echoing-dinner-19531

01/18/2023, 3:32 PM
It is a new method, was released just before Christmas holidays.
g

great-sunset-355

01/18/2023, 3:33 PM
ooh! great work! This should solve a lot of headaches! Thanks a lot for this!