-
Notifications
You must be signed in to change notification settings - Fork 809
Description
Issue:
@onlyIfNotExists() is good, but it appears to validate the resource existence only on the resource name (or Id). There are some cases where the uniqueness of the resource is not in its name/Id but in another property of the resource.
For instance, a private DNS zone supports only one vnet link to any given vnet. That uniqueness is not in the resource Name or Id, but rather in VirtualNetworkId property. @onlyIfNotExists() does not help when there is already a vnet link which was created using a name other than the one you are attempting to check before creating.
@onlyIfNotExists() resource virtualNetworkLink 'Microsoft.Network/privateDnsZones/virtualNetworkLinks@2020-06-01' = { parent: privateDnsZone name: vnetName location: 'global' properties: { registrationEnabled: false virtualNetwork: { id: vnetId } } }
Desired behavior:
@onlyIfNotExists() should support specifying a property of the resource to check for existence, or any other valid bicep operation which returns a true/false.
E.g. @onlyIfNotExists('VirtualNetworkId'=='<some_vnetId>')
Metadata
Metadata
Assignees
Labels
Type
Projects
Status