Closed BernieWhite closed 1 year ago
Support for lambdas would be great. I was doing a PoC with PSRule but we use some lambdas (filter, map) and therefore can't use it yet. The rest of the project looks really promising and helpful though - good job!
@BernieWhite Hello,
We were using PSRule but we now have a specific use case where we need the flatten
function.
So we are getting this error:
[error]Unable to expand resources because the source file 'D:\a\1\s\main.bicep' was not valid. An error occurred evaluating expression '[flatten(variables('allWebAppNames'))]' line 10102. The function "flatten" was not found.
I would like to keep using PSRule, are you aware of a workaround for the flatten
function that would be supported by PSRule?
@vinhent I'm not aware of any specific work around. We are currently working on adding language support for the new functions added to Bicep.
Fortunately flatten
is the easiest to implement and we will ship this with v1.23.0.
The remaining functions are likely to be released in v1.24.0 planned for late January.
@BernieWhite,
Might you be able to provide an ETA?
We are facing this issue with function Filter
.
[ERROR] Unable to expand resources because the source file 'C:\myRepo\infrastructure\deploy.bicep' was not valid. An error occurred evaluating expression '[length(filter(parameters('diagnosticLogCategoriesToEnable'), lambda('item', not(equals(lambdaVariables('item'), 'allLogs')))))]' line 1780. The function "filter" was not found.
Using PSRule
version 1.23.0 and PSRule.Rules.Azure
2.7.0
@Marc013 We're working on this now. Expect a pre-release in the next 2 days. A stable release v1.24.0 is likely to slide a little to around the 5th-7th of Feb.
Additional functions are planned to be added to ARM ~August:
filter
sort
map
reduce
flatten
lambdaVariables
lambda
https://learn.microsoft.com/azure/azure-resource-manager/bicep/bicep-functions-lambda
https://github.com/Azure/bicep/tree/8e74bc9e42bc65c57cfd4518c321e3ca125e015a/src/Bicep.Core.Samples/Files/Lambdas_LF