'How do I create multiple subscriptions with rules in multiple topics using bicep?

My goal here is to create multiple topics with multiple subscriptions and every subscription has its own rule(an sqlfilter in this case). The below solution which doesn't work renders this exception: *Internal Error - System.NotImplementedException: Mismatch between count of index expressions and inaccessible symbols during array access index expression rewriting. Am I using the namespace rule totally wrong or what am I missing? The NotImplementedException really makes it all confusing to me. I'm using Bicep version 0.6.1. I have not tested an older version of bicep yet but will definitely do so.

param topics array = [
  'customerevents'
  'ekonomievents'
  'orderevents'
]

var customerSubs = json(loadTextContent('./objects/customerSubscriptions.json'))

param parentResource string

resource servicebusNamespace 'Microsoft.ServiceBus/namespaces@2021-11-01' existing = {
  name: parentResource
}

resource topicResource 'Microsoft.ServiceBus/namespaces/topics@2021-11-01' = [for topic in topics : {
  name: topic
  parent: servicebusNamespace
  }]
  
resource subscriptionCustomer 'Microsoft.ServiceBus/namespaces/topics/subscriptions@2021-11-01' = [for (subscription, i) in customerSubs : {
  name: subscription.name
  dependsOn: topicResource
  parent: topicResource[0]
}]

resource subscriptionCustomerRules 'Microsoft.ServiceBus/namespaces/topics/subscriptions/rules@2021-11-01' = [for (subscription, i) in customerSubs : {
  name: uniqueString(subscription.name)
  parent: subscriptionCustomer[i]
  properties:{
    filterType:'SqlFilter'
    sqlFilter: {
      sqlExpression: '1=1'
      requiresPreprocessing: false
    }
  }
}]


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source