Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arm-ttk does not recognize parameters/variables references when the parameter/variable name is non-constant #771

Open
raouche opened this issue Mar 2, 2024 · 0 comments

Comments

@raouche
Copy link
Contributor

raouche commented Mar 2, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant