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

"items" is incorrectly flagged in full template validation mode #1654

Open
StephenWeatherford opened this issue Sep 27, 2023 · 1 comment
Open

Comments

@StephenWeatherford
Copy link
Contributor

From Azure/bicep#11954

THe following:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "bicep",
      "version": "0.21.1.54444",
      "templateHash": "2945005248419935276"
    }
  },
  "parameters": {
    "nsgValues": {
      "type": "object",
      "defaultValue": {
        "nsg1": {
          "name": "nsg-westus1",
          "location": "westus"
        },
        "nsg2": {
          "name": "nsg-east1",
          "location": "eastus"
        }
      }
    }
  },
  "resources": [
    {
      "properties": {},
      "copy": {
        "name": "nsg",
        "count": "[length(items(parameters('nsgValues')))]"
      },
      "type": "Microsoft.Network/networkSecurityGroups",
      "apiVersion": "2020-06-01",
      "name": "[items(parameters('nsgValues'))[copyIndex()].value.name]",
      "location": "[items(parameters('nsgValues'))[copyIndex()].value.location]"
    }
  ]
}

gives this error:

Template validation failed: The template resource '[items(parameters('nsgValues'))[copyIndex()].value.name]' at line '27' and column '5' is not valid: The template function 'items' is not valid. Please see https://aka.ms/arm-template-expressions for usage details.. Please see https://aka.ms/arm-template-expressions for usage details.

EXPECTED: no error

@StephenWeatherford
Copy link
Contributor Author

@dxk3355 Unfortunately, this false error is coming from our backend validation code from Azure which is out of date and no longer updated. We don't currently have the resources to fix this properly, as our focus is on Bicep. I apologize for the inconvenience.

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

No branches or pull requests

1 participant