[BUG] Deployments with more than one module fail at tenant scope #3167
Labels
bug
Something isn't working
feature: pre-flight-expansion
Issues relating to expansion of ARM and Bicep.
Milestone
Existing rule
No response
Description of the issue
Deployments that contain more than one module fail. Type of module, and complexity of module does not effect the failure. Pinning to an earlier version of PSRule.Rules.Azure (1.38.0) removes the error.
Having a single module referenced in the deployment does not cause the error.
Error messages
Error: Failed to expand bicep source '/home/runner/work/azure-governance/azure-governance/deployments/mg-platform/mg-out-of-band/deploy.bicep'. Exception calling "GetBicepResources" with "2" argument(s): "Unable to expand resources because the source file '/home/runner/work/azure-governance/azure-governance/deployments/mg-platform/mg-out-of-band/deploy.bicep' was not valid. Index was outside the bounds of the array."
Reproduction
Any deployment with more than one module present causes this error. Deployment sample
'
module mg '../../../modules/management-group/v1/main.bicep' = {
name: 'mg-outofband'
params: {
displayName: 'Out of Band'
parent: 'mg-platform'
}
}
module oobSubscription '../../../modules/subscription/v2/main.bicep' = {
scope: managementGroup(mg.name)
name: 'sub-oob-prd-001'
params: {
subscriptionManagementGroupId: mg.name
subscriptionBillingScope: billingScope.id
tags: {
businessOwner: ''
businessGroup: 'Infrastructure'
costCentre: 'Infrastructure'
environment: 'prd'
technicalContacts: 'i'
technicalGroup: 'Infrastructure'
sourceCode: 'github.com/aurizon/azure-governance'
}
assignments: [
{
principalId: ''
description: 'Grant permissions for deployments from azure-core-platform GitHub Actions.'
principalType: 'ServicePrincipal'
role: 'Owner'
}
]
emails: ''
subscriptionWorkload: 'Production'
}
}
`
Version of PSRule
2.9.0
Version of PSRule for Azure
1.39.3
Additional context
No response
The text was updated successfully, but these errors were encountered: