Conditionally include a property #1729
-
I have a case where I want to conditionally omit a property for a resource. I'd like to have that property set to false in certain conditions, but the property does not accept it. If it's present it needs to be true. If I want to set it to false, it has to be omitted altogether. I am aware we can conditionally set a value for a property, but that does not apply in this case. Is there a way to do this in bicep (or ARM)? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Have you tried setting the value to |
Beta Was this translation helpful? Give feedback.
-
@mickybar a lot of the tricks in ARM still work here, for instance using json('null') for complex object properties, or just '' for strings. See my fortigate templte for a lot of example of conditional properties and settings/"knobs" |
Beta Was this translation helpful? Give feedback.
Have you tried setting the value to
null
when the condition is false? This typically gets handled by the resource as if the property was not declared.