Hi, I'm referencing values from one stack to anoth...
# general
a
Hi, I'm referencing values from one stack to another, but some of those values might not exist, which is fine. I know the difference between RequireOutput and GetOutput using StackReference, but there doesn't seem to be a way to actually check if the value exists or not using an
if
. GetOutput never fails, but returns
null
as an Output, which then translates to the boolean
true
. Is there any way around this?
c
Copy code
import * as pulumi from "@pulumi/pulumi";

const config = new pulumi.Config("my-config");
const myVar = config.get("my-config-value");

if (typeof myVar !== 'undefined') {
    console.log('Config value exists');
} else {
    console.log('Config value does not exist');
}
a
But that's for configuration values, not Pulumi outputs from another stack.