https://pulumi.com logo
i

icy-controller-6092

06/13/2023, 5:51 AM
I guess this is not currently possible: https://github.com/pulumi/pulumi/issues/9112 Hopefully I can find a workaround
l

lemon-agent-27707

06/13/2023, 9:11 PM
You can do this via automation api. Something along the lines of:
Copy code
// Create our stack 
    const args: InlineProgramArgs = {
        stackName: "reference-stack",
        projectName: "reference-project",
        program: async () =>{} // dummy program

    refStack = await LocalWorkspace.selectStack(args);
    refValue = stack.getOutput("key")

    destStack.setConfig("key", refValue)
    desStack.up();
    };
basically: 1. select the stack to read the reference from 2. read the output value you need 3. select the destination stack 4. set the config value with the output of (2) 5. run an update
i

icy-controller-6092

06/14/2023, 1:09 AM
Hey Evan, I'm giving this a go but typescript tells me there is no
stack.getOutput
l

lemon-agent-27707

06/14/2023, 1:21 AM
Sorry the method is actually stack.outputs() and you’ll need to look in the returned map for the property you want.
i

icy-controller-6092

06/14/2023, 1:33 AM
that works! thank you 🙂 is it secure when using it with secrets?
l

lemon-agent-27707

06/14/2023, 2:16 AM
It uses the Pulumi CLI and Pulumi Cloud APIs under the hood, so very secure. However it is up to you to handle the values securely once you retrieve them. No different than using the CLI.