Azure / Azure/arm-template-whatif

Index loops not providing correct what if resource creation/modification count.

Open
#210 12 comments 0 reactions 1 assignee Claimed by @shenglol View on GitHub
Needs: Triage :mag:
Dominant language
HTML
Stars
101
Forks
21
Avg merge
3h 35m
Merged PRs (30d)
1

Description

**Describe the bug**
While Using a loop index on a count defined in a variable the `--confirm-with-what-if -c` flags do not show the correct item count and the print-out does not reflect any of the changes

**To Reproduce**
All resources are created as expected however the what-if explanation does not correctly show the changed resources.
```
resource vmNIC 'Microsoft.Network/networkInterfaces@2020-11-01' = [for vmNumber in range(0, vmCount) : {
name: 'nic-${vmName}-${vmNumber}'
location: deployLocation
properties: {
ipConfigurations: [
{
name: 'Main'
properties: {
privateIPAllocationMethod: 'Dynamic'
subnet: {
id: resourceId('Microsoft.Network/virtualNetworks/subnets', vmNetwork, vmSubnet)
}
publicIPAddress: vmHasPublic ? {
id: vmpublicIPAddress[vmNumber].id
} : null
}
}
]
}
}]
```

**Expected behavior**
The what-if flag will contain the resources that are configured for looping

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Client** [e.g. PowerShell, CLI, API)
Bicep CLI version 0.4.451 (e14a1f9511)

**Additional context**
Add any other context about the problem here.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.