Azure / template-specs

MIT License
31 stars 4 forks source link

An artifact path should be unique issue #73

Closed kannanMSFT closed 2 years ago

kannanMSFT commented 2 years ago

I am running into the following issue.

I have a main template that does deployments. I am trying to create two eventgrid topic subscriptions using a common linked template ("artifacts/addQueueEventSubscriptionToEventGridTopic.json"). But the moment I add the second deployment using the same linked template I get the error "(TemplateSpecVersionInvalidArtifactPath) The artifact path 'artifacts/addQueueEventSubscriptionToEventGridTopic.json' is not supported. An artifact path should be unique and not contain any expressions.". If I remove the second deployment which seems fine to me, it doesn't report this error.

Why does the artifact path be unique in the main template? Because it then defeats the purpose of modularization.

{
        "type": "Microsoft.Resources/deployments",
        "apiVersion": "2021-04-01",
        "name": "addQueue01EventSubscriptionToEventGridSystemTopic",
        "dependsOn": [
        "[resourceId('Microsoft.Resources/deployments', 'createEventGridSystemTopic')]"
        ],
        "subscriptionId": "[parameters('subscriptionId')]",
        "resourceGroup": "[variables('resourceGroupName')]",
        "properties": {
          "mode": "Incremental",
          "templateLink": {
            "relativePath": "artifacts/addQueueEventSubscriptionToEventGridTopic.json"
          },
          "parameters": {
            "stgName": {
              "value" : "[variables('storageName')]"
            },
            "systemTopicName" : {
              "value": "[variables('systemTopicName')]"
            },
            "subscriptionName": {
              "value": "sub01"
            },
            "queueName" : {
              "value": "fhirevents"
            }
          }
        }
      },
      {
        "type": "Microsoft.Resources/deployments",
        "apiVersion": "2021-04-01",
        "name": "addQueue02EventSubscriptionToEventGridSystemTopic",
        "dependsOn": [
        "[resourceId('Microsoft.Resources/deployments', 'addQueue01EventSubscriptionToEventGridSystemTopic')]"
        ],
        "subscriptionId": "[parameters('subscriptionId')]",
        "resourceGroup": "[variables('resourceGroupName')]",
        "properties": {
          "mode": "Incremental",
          "templateLink": {
            "relativePath": "artifacts/addQueueEventSubscriptionToEventGridTopic.json"
          },
          "parameters": {
            "stgName": {
              "value" : "[variables('storageName')]"
            },
            "systemTopicName" : {
              "value": "[variables('systemTopicName')]"
            },
            "subscriptionName": {
              "value": "sub02"
            },
            "queueName" : {
              "value": "fhirevents-archive"
            }
          }
        }
      }
kannanMSFT commented 2 years ago

Thanks to @stuartko for following up. For some reason we are unable to reproduce this issue anymore. The template is exactly the same as above in the issue, but I don't get the error message anymore. So maybe something has changed in the backend or az cli. Not sure. With that I am closing this issue.