https://pulumi.com logo
Title
c

clever-painter-96148

12/27/2022, 8:58 AM
When using pulumi-command, is there a way for the delete script to access the output of the create script? e.g. How do I make something like this work?
mktemp = Command('mktemp', create='mktemp', delete='rm {path}')
So far I achieved this using:
from pulumi import Output, export
from pulumi_command.local import Command

mktemp_create = Command('mktemp-create', create='mktemp')
mktemp_delete = Command('mktemp-delete', delete=Output.format('rm {path}', path=mktemp_create.stdout))
export('tmp_file', mktemp_create.stdout)
But that feels wrong. 🤔
e

echoing-dinner-19531

12/27/2022, 10:00 AM
I think that's as good as you can do now. The commands are just literal strings and they can't refer to the same command they're created in.
c

clever-painter-96148

12/27/2022, 10:00 AM
OK, good to know, thanks @echoing-dinner-19531!
w

white-balloon-205

12/27/2022, 7:13 PM
This question has come up a few times recently - I opened https://github.com/pulumi/pulumi-command/issues/167 to track it.