Is there a way to return a boolean instead of an O...
# general
g
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
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
If you are conditionally provisioning resources, worth voting on https://github.com/pulumi/pulumi/issues/4834
g
@miniature-musician-31262 That is right!
What is the best way to check if the output is equal to a specific value?
e
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
How can this in turn be evaluated? I.e. whether this is True or False
e
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.