-
Notifications
You must be signed in to change notification settings - Fork 54
Open
Labels
Description
Prerequisites
- Write a descriptive title.
- Make sure you are able to repro it on the latest version
- Search the existing issues.
Summary
I am experiencing a problem with using lambda variables from map() function as arguments to nested function calls in DSC expressions whilst working on #1230.
Steps to reproduce
- Create a DSC configuration with a map() expression that uses a lambda variable
- Pass the lambda variable as an argument to a function within the map body
- Execute the configuration
Example config:
$schema: https://aka.ms/dsc/schemas/v3/bundled/config/document.json
parameters:
baseNetwork:
type: string
defaultValue: 10.144.0.0/20
newPrefix:
type: int
defaultValue: 24
subnetCount:
type: int
defaultValue: 5
resources:
- name: Generate subnets
type: Microsoft.DSC.Debug/Echo
properties:
output: "[map(range(0, parameters('subnetCount')), 'i', cidrSubnet(parameters('baseNetwork'), parameters('newPrefix'), i))]"Expected behavior
The `map()` function should iterate over the range [0, 1, 2, 3, 4], pass each value as the lambda variable i, and successfully call `cidrSubnet()` with that variable as the third argument. The output should be an array of 5 subnet CIDR strings.Actual behavior
ERROR Parser: Found error node parsing functionError details
Environment data
Name Value
---- -----
PSVersion 7.5.4
PSEdition Core
GitCommitId 7.5.4
OS Microsoft Windows 10.0.26100
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0Version
dsc 3.2.0-preview.7
Visuals
No response