Closed SvenAelterman closed 1 year ago
Are all of the subnets part of the same vnet? If so, can you do something like this w/ lambda functions?
resource vnet 'Microsoft.Network/virtualNetworks@2022-01-01' existing = {
name: 'myVnet'
}
var reduceThings = reduce(vnet.properties.subnets, {}, (prev, cur) => union(prev, { '${cur.name}': {
id: cur.id
name: cur.name
addressPrefixes: cur.properties.addressPrefixes
}}))
Related to #8519. Definitely feels like we need a more straightforward way to go from array to dictionary.
@alex-frankel Yes, they are all part of the same VNet. I'll try out those lambda functions.
Hi SvenAelterman, this issue has been marked as stale because it was labeled as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment. Thanks for contributing to bicep! :smile: :mechanical_arm:
I would like to be able to create custom dictionary objects from arrays, such as when outputting the result of a loop. Currently, we can only use arrays for that, but that makes using that output dependent on the position of a particular resource in an array not changing. This isn't always guaranteed.
I would like to do something like this: