Hi all, I would like to see if the community has s...
# general
f
Hi all, I would like to see if the community has some best practices related to creating dependencies between non-resource tasks consider the following set of tasks 1. generate a file from the pulumi program 2. read the generated file and provide it as an input to a Resource there must be a dependency injected -> step2 depends on step1 and can’t be executed concurrently How would you create such a dependency? Would you create an artificial
done
output at the end of step1 and then use
done.apply(step2Func())
?
w
Yeah - that sounds generally right. In the case that you need to do these tasks in between one resources outputs and another resources inputs - the easiest thing is to create an (async) function that does the work, and put it in an
apply
in between the Output from the first resources, and the value passed to the second. If you have a code example of what you are hoping to do, might be able to pointto a more concrete suggestion.
f
Thanks Luke A more concrete example could be a pseudocode main function that looks like this:
Copy code
def create_file(): 
  # creates a file file1.txt

def reads_file():
  # read file file1.txt, need to make sure it waits for create_file() to complete first

def create_resource():
  # creates a resource Res1 with its name being set to the contents of the reads_file() output