rapid-receptionist-28528
12/26/2022, 11:20 AMclever-painter-96148
12/26/2022, 3:49 PMimport { LocalProgramArgs, LocalWorkspace } from "@pulumi/pulumi/automation";
const stack1 = await LocalWorkspace.selectStack({workDir: '/path/to/project1', stackName: 'foo'});
await stack1.up();
const stack2 = await LocalWorkspace.selectStack({workDir: '/path/to/project2', stackName: 'bar'});
await stack2.up();
The only missing piece here is to make the project2/bar stack to consume outputs from the project1/foo stack.rapid-receptionist-28528
12/26/2022, 8:26 PMclever-painter-96148
12/26/2022, 8:32 PMrapid-receptionist-28528
12/27/2022, 12:16 PMconst stack1 = await LocalWorkspace.selectStack(args1)
const upRes1: UpResult = await stack1.up({})
const stack1outputs = upRes1.outputs
--------------------------
const stack2 = await LocalWorkspace.selectStack(args2, stack1outputs) // here
const upRes2: UpResult = await stack2.up(stack1outputs) // or here
according to documentation it’s not an option But
I’m asking if there is a workaround in order to achieve that ?
I found this example in go
https://github.com/pulumi/automation-api-examples/blob/main/go/multi_stack_orchestration/main.go
looking for something similar in typescript
Thanks!clever-painter-96148
12/27/2022, 1:18 PMconst stack1 = await LocalWorkspace.createOrSelectStack(stack1args);
const stack2 = await LocalWorkspace.createOrSelectStack(stack2args);
await stack2.setConfig("stack2:some-key", { value: stack1.outputs.outputName.value });
await stack2.up();
(disclaimer: did not try - i only used the automation api in python so far)rapid-receptionist-28528
12/27/2022, 3:30 PMindex.ts
of that project.
how can I access the stack2:some-key
inside that file ?clever-painter-96148
12/27/2022, 3:55 PMconst config = new Config();
const value = config.require('some-key');
rapid-receptionist-28528
12/29/2022, 8:03 AMclever-painter-96148
12/29/2022, 8:12 AMDo you think it’s the best practice ?Not sure, I started using the Automation API a few days ago. 😅 Maybe @many-telephone-49025, @billowy-army-68599 or @limited-rainbow-51650 can help?
I mean where exactly those config located ?Yes, configuration done with the Automation API gets written on your local filesysteme in
Pulumi.$STACK.yaml
.
what if I have big outputs to forward to next stacks ? what are the limitations ?It's a configuration API. I am not sure about the exact limitations but I'd avoid passed big payload there.
rapid-receptionist-28528
12/29/2022, 1:21 PMautomation-api
billowy-army-68599
12/29/2022, 2:40 PMrapid-receptionist-28528
12/29/2022, 3:43 PMbillowy-army-68599
12/29/2022, 4:00 PM