https://pulumi.com logo
#general
Title
# general
m

millions-furniture-75402

05/26/2023, 2:26 PM
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

echoing-dinner-19531

05/29/2023, 1:35 PM
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

millions-furniture-75402

05/30/2023, 12:26 PM
I specifically don't want to to use the general purpose programming language conditions if possible in this case.
e

echoing-dinner-19531

05/30/2023, 12:28 PM
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

millions-furniture-75402

05/30/2023, 12:29 PM
Thank you, that sounds like what I'm enquiring about.
6 Views