When PSRule attempts to expand my bicep source, it fails due to a filter statement. The filter seems to work as expected in deployments, so this appears to be an issue with PSRule bicep expansion.
To Reproduce
Steps to reproduce the issue:
// Getting the IP from the first NIC of the node with a default gateway. Only the first management NIC should have a gateway defined.
// This reference call requires that the 'DeviceManagementExtension' extension be fully initialized on each node, which creates the
// referenced edgeDevices sub-resource, containing the IP configuration.
ipv4Address: (filter(
reference('${hciNode}/providers/microsoft.azurestackhci/edgeDevices/default', '2024-01-01', 'Full').properties.deviceConfiguration.nicDetails,
nic => nic.?defaultGateway != null
))[0].ip4Address
Expected behaviour
Error output
Using PSRule v2.9.0
Using PSRule.Rules.Azure v1.38.0-B0034
----------------------------
Explore documentation: https://aka.ms/ps-rule
Contribute and find source: https://github.com/microsoft/PSRule
Report issues: https://github.com/microsoft/PSRule/issues
PSRule.Rules.Azure: https://aka.ms/ps-rule-azure
----------------------------
From repository: https://github.com/mbrat2005/bicep-registry-modules
on : mtb-azure-stack-hci-cluster
at : a5b87fcf970b932895a78a86a2b24d22ae812b87
Error: Failed to expand bicep source '/home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/res/azure-stack-hci/cluster/tests/e2e/2nodeswitched.defaults/main.test.bicep'. Exception calling "GetBicepResources" with "2" argument(s): "Unable to expand resources because the source file '/home/runner/work/bicep-registry-modules/bicep-registry-modules/avm/res/azure-stack-hci/cluster/tests/e2e/2nodeswitched.defaults/main.test.bicep' was not valid. An error occurred evaluating expression '[filter(reference(format('{0}/providers/microsoft.azurestackhci/edgeDevices/default', variables('arcNodeResourceIds')[copyIndex('physicalNodes')]), '2024-01-01', 'Full').properties.deviceConfiguration.nicDetails, lambda('nic', not(equals(tryGet(lambdaVariables('nic'), 'defaultGateway'), null()))))[0].ip4Address]' line 2800. The arguments for 'Filter' are not in the expected format or type."
Description of the issue
When PSRule attempts to expand my bicep source, it fails due to a filter statement. The filter seems to work as expected in deployments, so this appears to be an issue with PSRule bicep expansion.
To Reproduce
Steps to reproduce the issue:
Expected behaviour
Error output
Module in use and version:
Captured output from
$PSVersionTable
:Additional context