https://pulumi.com logo
Title
g

glamorous-answer-86536

01/13/2023, 5:46 PM
Is there a way to return a boolean instead of an Output again for an if statement?
var = True if some_output['value'].apply(lambda x: f"{x}") != "AWS" else False
The "AWS" value is actually just an export in another stack
m

miniature-musician-31262

01/13/2023, 10:08 PM
The short answer is no, but you can definitely obtain and use that value — you’ll just need to work with it as an output. Are you conditionally provisioning resources based that value?
e

echoing-dinner-19531

01/13/2023, 10:16 PM
If you are conditionally provisioning resources, worth voting on https://github.com/pulumi/pulumi/issues/4834
g

glamorous-answer-86536

01/14/2023, 11:33 AM
@miniature-musician-31262 That is right!
What is the best way to check if the output is equal to a specific value?
e

echoing-dinner-19531

01/16/2023, 4:50 PM
some_output.apply(lambda x: x == "specific value")
but it will be an Output<bool>, as Christian said above you've got to work with it as an output.
g

glamorous-answer-86536

01/17/2023, 7:10 AM
How can this in turn be evaluated? I.e. whether this is True or False
e

echoing-dinner-19531

01/17/2023, 8:58 AM
Currently you have to write the rest of the program inside the apply. That allows you to see the value of the bool, but it does mean that preview generally won't see the resources created. The issue I linked above is tracking to improve this.