https://pulumi.com logo
b

bitter-dentist-28132

08/26/2019, 3:31 PM
is there a way to have an output inside of an
async
block? i tried doing
Copy code
export let output;
async function doAsyncStuff(() => {
  ...
  output = `${someResource.ingressHost}`;
});
doAsyncStuff().then(() => console.log(output));
the console.log prints `output`'s value in the diagnostics, but for whatever reason i don't get an actual stack output.
t

tall-librarian-49374

08/26/2019, 3:33 PM
You should probably return a value from
doAsyncStuff
and assign it to
output
.
Copy code
export let output = doAsyncStuff();
async function doAsyncStuff(() => {
  ...
  return`${someResource.ingressHost}`;
});
Otherwise you might read
output
before it's ready.
b

bitter-dentist-28132

08/27/2019, 8:36 PM
ah, so an output can be a promise, and that promise's resolve value will be the value of the output?
t

tall-librarian-49374

08/27/2019, 9:12 PM
yes. You can also wrap a promise into
pulumi.output
if you need to use it for inputs to other resources.