Azure / arm-ttk

Azure Resource Manager Template Toolkit
https://aka.ms/arm-ttk
MIT License
441 stars 188 forks source link

arm-ttk does not seem to recognize an outputs reference to a DropDown living inside an EditableGrid's column #768

Open raouche opened 7 months ago

raouche commented 7 months ago

arm-ttk version: 0.24 Scenario: A DropDown control inside a column in an EditableGrid control is referenced in an "outputs" parameter using the following expression (see the full CUID sample at the very bottom) that references it via a reference to the containing column's column id: [concat('Value: ', first(basics('EditableGrid1')).Column1)]

Problem: When running arm-ttk against the example shown below, the following error is returned:

arm-ttk: Failed: Allowed Values Should Actually Be Allowed
Error: Could not find DropDown1 in outputs

NOTE: The same issue is also noticed when placing an OptionsGroup control inside an EditableGrid's column. But a TextBox seems to fare well though.

What are we missing here?

Full sample CUID:

{
  "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#",
  "handler": "Microsoft.Azure.CreateUIDef",
  "version": "0.1.2-preview",
  "parameters": {
    "basics": [
      {
        "ariaLabel": "EditableGrid1",
        "constraints": {
          "columns": [
            {
              "element": {
                "constraints": {
                  "allowedValues": [
                    {
                      "label": "Item1",
                      "value": "Value1"
                    },
                    {
                      "label": "Item2",
                      "value": "Value2"
                    }
                  ]
                },
                "label": "DropDown1",
                "name": "DropDown1",
                "toolTip": "DropDown1",
                "type": "Microsoft.Common.DropDown"
              },
              "header": "Column1",
              "id": "Column1",
              "width": "1fr"
            }
          ]
        },
        "label": "EditableGrid1",
        "name": "EditableGrid1",
        "type": "Microsoft.Common.EditableGrid"
      }
    ],
    "steps": [],
    "outputs": {
      "location": "[location()]",
      "EditableGrid1": "[concat('Value: ', first(basics('EditableGrid1')).Column1)]"
    }
  },
  "metadata": {
    "_generator": {
      "name": "MaestroStudio",
      "sku": "Solo",
      "version": "0.9.0.0",
      "template": {
        "author": "StratusOn",
        "id": "EA622966-CE0C-46E7-841B-73C2E6ED5DEB",
        "description": "A blank Azure Marketplace Managed Application offer."
      }
    },
    "_sync": {
      "offer": {
        "displayName": "My Offer"
      },
      "plan": {
        "displayName": "Plan"
      }
    }
  }
}
vidapour commented 6 months ago

Hi @raouche can you provide the parameters section that you've added in your main template? Thanks :)

raouche commented 6 months ago

Hi @vidapour -- For sure, you bet! And thanks for looking into this.

Here's an ARM template sample (not just the params). It's a no-op ARM Template sample that passes the arm-ttk without deploying anything (but the issue was discovered in a real-life, large template).

One thing I should have mentioned before was that if the same DropDown was placed outside of the EditableGrid (for example inside basics) and referenced in the outputs, it passes arm-ttk's checks with flying colors, so this is not likely related to not having allowedValues on the ARM template param.

Anyway, here you go -- hope this helps:

{
  "$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "metadata": {
    "_generator": {
      "name": "MaestroStudio",
      "sku": "Solo",
      "version": "0.9.0.0",
      "template": {
        "author": "StratusOn",
        "id": "EA622966-CE0C-46E7-841B-73C2E6ED5DEB",
        "description": "A blank Azure Marketplace Managed Application offer."
      }
    }
  },
  "parameters": {
    "location": {
      "type": "string"
    },
    "EditableGrid1": {
      "type": "string",
      "metadata": {
        "description": "TODO: EditableGrid1 description."
      }
    }
  },
  "resources": [
    {
      "type": "Microsoft.Resources/deployments",
      "apiVersion": "2023-07-01",
      "name": "Noop",
      "properties": {
        "mode": "Incremental",
        "parameters": {
          "location": {
            "value": "[parameters('location')]"
          },
          "editableGrid1": {
            "value": "[parameters('EditableGrid1')]"
          }
        },
        "template": {
          "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
          "contentVersion": "1.0.0.0",
          "resources": [
          ]
        }
      }
    }
  ]
}