Azure / Azure/azure-quickstart-templates

Re-running same ARM template to create service bus topic is failing with cannot change partition

Open
#13,156 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Bicep
Stars
14.9k
Forks
16.2k
Avg merge
6d 21h
Merged PRs (30d)
6

Description

servicebus-topic, bicep sample

Template is not idempotent to create topic?

### Issue Details

The bicep sample in the azure website https://learn.microsoft.com/en-us/azure/templates/microsoft.servicebus/namespaces/topics?pivots=deployment-language-bicep is not idempotent.

Re-executing the same template produces an error "Partitioning cannot be changed for Topic", but I am NOT changing the partitioning, I am simply re-executing the same template again.

### Repro steps (*if necessary, delete otherwise*)
Here is my bicep:

```
param serviceBusNamespaceName string
param serviceBusSkuName string

@description('Location for all resources')
param defaultLocation string = resourceGroup().location

resource serviceBusNamespace 'Microsoft.ServiceBus/namespaces@2022-01-01-preview' = {
name: serviceBusNamespaceName
location: defaultLocation
sku: {
name: serviceBusSkuName
}
}

resource incidentsTopic 'Microsoft.ServiceBus/namespaces/topics@2022-01-01-preview' = {
name: 'incidents'
parent: serviceBusNamespace
properties: {
defaultMessageTimeToLive: 'P14D'
duplicateDetectionHistoryTimeWindow: 'PT10M'
enableBatchedOperations: true
enablePartitioning: true
maxSizeInMegabytes: 1024
requiresDuplicateDetection: true
autoDeleteOnIdle: 'P10675199DT2H48M5.4775807S'
}
}
```

Here is the generated template:

```json
"template": {
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"metadata": {
"_generator": {
"name": "bicep",
"version": "0.11.1.770",
"templateHash": "7531567923296483781"
}
},
"parameters": {
"serviceBusNamespaceName": {
"type": "string"
},
"serviceBusSkuName": {
"type": "string"
},
"defaultLocation": {
"type": "string",
"defaultValue": "[resourceGroup().location]",
"metadata": {
"description": "Location for all resources"
}
}
},
"resources": [
{
"type": "Microsoft.ServiceBus/namespaces",
"apiVersion": "2022-01-01-preview",
"name": "[parameters('serviceBusNamespaceName')]",
"location": "[parameters('defaultLocation')]",
"sku": {
"name": "[parameters('serviceBusSkuName')]"
}
},
{
"type": "Microsoft.ServiceBus/namespaces/topics",
"apiVersion": "2022-01-01-preview",
"name": "[format('{0}/{1}', parameters('serviceBusNamespaceName'), 'incidents')]",
"properties": {
"defaultMessageTimeToLive": "P14D",
"duplicateDetectionHistoryTimeWindow": "PT10M",
"enableBatchedOperations": true,
"enablePartitioning": true,
"maxSizeInMegabytes": 1024,
"requiresDuplicateDetection": true,
"autoDeleteOnIdle": "P10675199DT2H48M5.4775807S"
},
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', parameters('serviceBusNamespaceName'))]"
]
}
]
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the linked Microsoft.ServiceBus/namespaces/topics Bicep sample and reproduce the deployment using the template and parameters shown in the issue. Compare the first and repeated deployments, then verify whether the sample or the Azure Service Bus API owns the partition-change error. Done means the issue has a confirmed repository-side change or a documented external-service limitation.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.