Open DrEsteban opened 1 month ago
FWIW you could probably use the map
function instead as a workaround:
using './deploy.bicep'
var matrix = [
{
namePrefix: 'e10impactx4'
sku: 'Enterprise_E10'
capacity: 4
}
{
namePrefix: 'e10impact'
sku: 'Enterprise_E10'
capacity: 2
}
{
namePrefix: 'e5impactx4'
sku: 'Enterprise_E5'
capacity: 4
}
{
namePrefix: 'e5impact'
sku: 'Enterprise_E5'
capacity: 2
}
]
var type1 = map(matrix, item => {
namePrefix: item.namePrefix
sku: item.sku
capacity: item.capacity
clusteringPolicy: 'EnterpriseCluster'
})
var type2 = map(matrix, item => {
namePrefix: '${item.namePrefix}-ent'
sku: item.sku
capacity: item.capacity
clusteringPolicy: 'OSSCluster'
})
param testMatrix = concat(type1, type2)
That worked!! Thanks @anthony-c-martin! I'll be keeping this option in mind in the future.
Do you agree my original approach should be valid, intuitively? Or at least have a better error message to direct the user?
Do you agree my original approach should be valid, intuitively? Or at least have a better error message to direct the user?
Yes, completely agree that intuitively it should work - we either need to fix the underlying problem, or improve the error message. I just wanted to unblock you with a workaround while we investigate further!
Bicep version
Bicep CLI version 0.29.47 (132ade51bc)
Describe the bug To reduce duplication, I attempted to dynamically build a parameter in a
.bicepparam
file usingvar
s,[for]
s, and array functions which appears to be valid according to documentation. However it resulted in error:To Reproduce
deploy.bicep
deploy.bicepparams
Additional context Basically, I wanted to build a test matrix input where all items had the same properties except for
clusteringPolicy
. I tried restructuring the above lots of ways, but none of them worked 😢 In the end I had to manually copy/paste/update.Note, though, that the following does work:
So it doesn't seem to be a fundamental limitation of
.bicepparam
files. (The ability to concatenate arrays.) The system just doesn't like when I try to dynamically build the different sub-arrays with a[for]
loop.