arm-ttk does not recognize parameters/variables references when the parameter/variable name is non-constant
- Dominant language
- PowerShell
- Stars
- 468
- Forks
- 208
- PR merge metrics
- No merged PRs in 30d
Description
**arm-ttk version:** 0.24
**Scenario:** Suppose an ARM template takes 3 NIC name parameters, like so:
```
"networkInterfaceName1": {
"type": "string"
},
"networkInterfaceName2": {
"type": "string",
"defaultValue": ""
},
"networkInterfaceName3": {
"type": "string",
"defaultValue": ""
},
```
... and suppose that the parameters are referenced inside a NIC resource that uses the `copyIndex()` function to grab the value of each parameter, like so:
```
{
"name": "[parameters(concat('networkInterfaceName', copyIndex(1)))]",
"type": "Microsoft.Network/networkInterfaces",
"apiVersion": "2022-07-01",
"location": "[parameters('location')]",
"copy": {
"name": "networkInterfaceCopy",
"count": "[parameters('numberOfZones')]"
}
},
```
**Problem:** Instead of recognizing that the parameters are being used in the NIC resource's iterations by constructing their names dynamically instead of having 3 different resource declarations. arm-ttk returns the following error, which seem to indicate that it is expecting static property names:
```
- Error: Unreferenced parameter: networkInterfaceName1
- Error: Unreferenced parameter: networkInterfaceName2
- Error: Unreferenced parameter: networkInterfaceName3
```
**NOTE:** The same behavior outlined above is also exhibited with variables when their names are dynamically constructed.
While it is possible to work around this when the number of iterations is small, the issue is exacerbated when the number of iterations is considerably high.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.