Help with a array with multiple conditions. #12987
-
Beta Was this translation helpful? Give feedback.
Answered by
anthony-c-martin
Jan 12, 2024
Replies: 1 comment 1 reply
-
Without seeing a more complete sample, it's hard to know exactly what to recommend, but something like the following should work - essentially using the module resourceGroupNetworking 'modules/resourcegroup.bicep' = {
name: networkingResourceGroupName
scope: subscription()
params: {
name: networkingResourceGroupName
location: location
roleAssignments: union(
contains(subnetNames, 'aks') ? [
{
description: 'aks umi network contributor ccc'
principalIds: contains(subnetNames, 'aks') ? [
aksUMI01.outputs.principalld
] : []
principalType: 'ServicePrincipal'
roleDefinitionIdOrName: 'Network Contributor'
}
] : [],
contains(subnetNames, 'backup') ? [
{
description: 'backup umi network contributor'
principalIds: contains(subnetNames, 'backup') ? [
bkUMI01.outputs.principalId
] : []
principalType: 'ServicePrincipal'
roleDefinitionIdOrName: 'Network Contributor'
}
] : [])
}
} |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
GBCSIM1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Without seeing a more complete sample, it's hard to know exactly what to recommend, but something like the following should work - essentially using the
union()
function to construct an array with multiple entries: