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] Handling of for array index symbols #2548

Closed
BernieWhite opened this issue Nov 22, 2023 · 0 comments · Fixed by #2549
Closed

[BUG] Handling of for array index symbols #2548

BernieWhite opened this issue Nov 22, 2023 · 0 comments · Fixed by #2549
Assignees
Labels
bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep.
Milestone

Comments

@BernieWhite
Copy link
Collaborator

Existing rule

No response

Description of the issue

A problem exists when trying to cross reference array symbols for iterated resources.

Error messages

No response

Reproduction

resource storageAccount_objectReplicationPolicyItems 'Microsoft.Storage/storageAccounts/objectReplicationPolicies@2022-09-01' = [for (item, index) in [ 1 ]: {
  name: 'default${index}'
  parent: storage
  properties: {
    sourceAccount: 'sourceId'
    destinationAccount: 'destId'
    rules: [
      {
        ruleId: null
        sourceContainer: 'source'
        destinationContainer: 'dest'
        filters: null
      }
    ]
  }
}]

output fromFor string = storageAccount_objectReplicationPolicyItems[0].properties.sourceAccount

This emits the following expression [reference(format('storageAccount_objectReplicationPolicyItems[{0}]', 0)).sourceAccount] which can not be matched to a symbol.

Version of PSRule

2.9.0

Version of PSRule for Azure

1.31.2

Additional context

No response

@BernieWhite BernieWhite added bug Something isn't working feature: pre-flight-expansion Issues relating to expansion of ARM and Bicep. labels Nov 22, 2023
@BernieWhite BernieWhite added this to the v1.31.3 milestone Nov 22, 2023
@BernieWhite BernieWhite self-assigned this Nov 22, 2023
BernieWhite added a commit to BernieWhite/PSRule.Rules.Azure that referenced this issue Nov 22, 2023
BernieWhite added a commit to BernieWhite/PSRule.Rules.Azure that referenced this issue Nov 22, 2023
@BernieWhite BernieWhite mentioned this issue Nov 22, 2023
4 tasks
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.

1 participant