How can I use the automation API to handle when on...
# automation-api
c
How can I use the automation API to handle when one stack depends on outputs from another stack? Right now I'm using
StackReference
but it only ties the stacks together with a string value (the name of the stack). I'd like to do this with an object reference so I can run a single command to bring up multiple stacks all in the correct order. Is something like this possible?
l
Yep. Just await the first up, then run the 2nd up. You can use inline programs to make it clearer, but both methods work.
l
Here's an example of a go program that splits up a deployment across two stacks with automation api: https://github.com/pulumi/automation-api-examples/blob/main/go/multi_stack_orchestration/main.go
First it deploys the bucket in one stack, then it references that bucket as a stack output and it feeds that bucketId into a function that generates the next program. You can see here that the program for the object stack is parameterized to curry the bucketId.
c
great! thanks guys!