Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] Deployments with more than one module fail at tenant scope #3167

Closed
jonathankerkin opened this issue Nov 5, 2024 · 2 comments · Fixed by #3176
Closed

[BUG] Deployments with more than one module fail at tenant scope #3167

jonathankerkin opened this issue Nov 5, 2024 · 2 comments · Fixed by #3176
Assignees
Labels
bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep.
Milestone

Comments

@jonathankerkin
Copy link

jonathankerkin commented Nov 5, 2024

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

@jonathankerkin jonathankerkin added bug Something isn't working Needs: Triage 🔍 Needs attention from the team. labels Nov 5, 2024
@BernieWhite BernieWhite added feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep. and removed Needs: Triage 🔍 Needs attention from the team. labels Nov 5, 2024
@BernieWhite
Copy link
Collaborator

Thanks for reporting the issue @jonathankerkin

@BernieWhite BernieWhite self-assigned this Nov 7, 2024
@BernieWhite BernieWhite changed the title [BUG] Deployments with more than one module fail [BUG] Deployments with more than one module fail at tenant scope Nov 11, 2024
BernieWhite added a commit to BernieWhite/PSRule.Rules.Azure that referenced this issue Nov 11, 2024
@BernieWhite BernieWhite added this to the v1.40.0 milestone Nov 11, 2024
@BernieWhite
Copy link
Collaborator

@jonathankerkin This should be fixed in latest preview PSRule for Azure v1.40.0-B0147.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants