Is there a way to make a resource deployment condi...
# general
m
Is there a way to make a resource deployment conditional within the declaration? e.g. Instead of:
if (thing) { new resource({...}); }
declare within the "DSL":
new resource({...}, { condition: (resource) => resource.instanceQuantity == 1 });
Can I abuse a
transformation
for this?
e
If "thing" is a standard boolean condition you can just write an if statement. If "thing" is an
Output
value then you can do an apply and write an if inside that, just be aware preview might not be able to show this. I've been prototyping some ideas to support this in a more first class way but its tricky ideas and that work is still a while off.
m
I specifically don't want to to use the general purpose programming language conditions if possible in this case.
e
Add a vote to https://github.com/pulumi/pulumi/issues/4834, but we don't have first class support for conditions yet. Definitely something we want to do, just tricky and not clear how prioritised it needs to be.
m
Thank you, that sounds like what I'm enquiring about.