-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Closed as not planned
Labels
ProvisioningProvisioning.CoreThis item is related to the core Azure.Provisioning featuresThis item is related to the core Azure.Provisioning features
Description
Problem
BicepFunction in Azure.Provisioning does not expose Bicep's union() built-in function. This is needed for non-destructive updates to existing resources — most commonly, adding a tag to an existing resource group without replacing all existing tags.
Motivating scenario
Adding a tag to an existing resource group without removing existing tags requires union():
resource existingRg 'Microsoft.Resources/resourceGroups@2023-07-01' existing = {
name: 'my-demo-rg'
}
resource updatedRg 'Microsoft.Resources/resourceGroups@2023-07-01' = {
name: 'my-demo-rg'
location: existingRg.location
tags: union(existingRg.tags, { env: 'prod' }) // merge, don't replace
}This cannot be expressed today through the Azure.Provisioning API. Users must either accept destructive tag replacement or drop down to raw Bicep.
Proposed API
public static BicepValue<object> Union(params BicepValue<object>[] values);
// Usage
updatedRg.Tags = BicepFunction.Union(existingRg.Tags, new BicepDictionary<string> { ["env"] = "prod" });Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
ProvisioningProvisioning.CoreThis item is related to the core Azure.Provisioning featuresThis item is related to the core Azure.Provisioning features