https://pulumi.com logo
#general
Title
# general
s

shy-army-45455

05/07/2019, 2:02 AM
I've tried a few different things, but still can't seem to correctly convert an output from another stack into a string using stack.getOutput + val.apply(v =>
${v}
). Are there any examples on how to do this? I need to get the pure string value so I can use it in a subsequent child_process.exec call.
w

white-balloon-205

05/07/2019, 5:07 PM
Sorry for missing the previous couple of asks on this. If you have not yet checked out https://pulumi.io/reference/programming-model.html#outputs I'd suggest taking a look at that - it covers many aspects of how to work with `Output`s. As for invoking
exec
- you'd need something like:
Copy code
output.apply(v => {
  exec(v);
});
That is - you only have access to the value of the output within the callback for the
apply
, so you'll want to invoke the
exec
inside that scope. This is because the
apply
will actually not always run - it will only run once the value of the output is known - which may not be available during a preview. (In the case of StackReference though, I believe it is the case these will always be available).
s

shy-army-45455

05/07/2019, 10:16 PM
I see, I'll try that. Thanks!