Azure Service bus single topic with multiple subscriptions creation

I am creating Azure service bus topics named topic1, topic2 and topic3 using Terraform. create two subscriptions named topic1-subscription1, and topic1-subscription2 under topic1 and two subscriptions namedtopic2-subscription1, topic2-subscription2 under topic2 but topic3holds only one subscription called topic3-subscription1 using terraform for_each loop.

`Topics:

  • Topic1

    • Topic1-subscription1

    • Topic1-subscription2

  • Topic2

    • Topic2-subscription1

    • Topic2-subscription2

    • Topic2-subscription3

  • Topic3

  • Topic3-subscription1
    `

locals {
topic1 = {
      subscriptions = ["topic1-subscription1", "topic1-subscription2"]
    }
    topic2 = {
      subscriptions = ["topic2-subscription1", "topic2-subscription2", "topic2-subscription3"]
    }
    topic3 = {
      subscriptions = ["topic3-subscription1"]
    }
  }
}

resource "azurerm_servicebus_topic" "example" {
  for_each               = local.topic_names
  name                = each.key
  namespace_id        = module.service_bus.id
}

resource "azurerm_servicebus_subscription" "example" {
  for_each = { for topic, config in local.topic_names : topic => config.subscriptions }
  topic_id           = azurerm_servicebus_topic.example[each.key].id
  name = each.value[0]
}

terraform plan only showing 0 index of the list(string). how to loop subscriptions list.

 # azurerm_servicebus_subscription.example["topic1-subscription1"] will be created
  + resource "azurerm_servicebus_subscription" "example" {
      + auto_delete_on_idle                       = (known after apply)
      + client_scoped_subscription_enabled        = false
      + dead_lettering_on_filter_evaluation_error = true
      + default_message_ttl                       = (known after apply)
      + id                                        = (known after apply)
      + lock_duration                             = (known after apply)
      + max_delivery_count                        = 1
      + name                                      = "topic1-subscription1"
      + status                                    = "Active"
      + topic_id                                  = (known after apply)
    }

 # azurerm_servicebus_subscription.example["topic2-subscription1"] will be created
  + resource "azurerm_servicebus_subscription" "example" {
      + auto_delete_on_idle                       = (known after apply)
      + client_scoped_subscription_enabled        = false
      + dead_lettering_on_filter_evaluation_error = true
      + default_message_ttl                       = (known after apply)
      + id                                        = (known after apply)
      + lock_duration                             = (known after apply)
      + max_delivery_count                        = 1
      + name                                      = "topic2-subscription1"
      + status                                    = "Active"
      + topic_id                                  = (known after apply)
    }
 # azurerm_servicebus_subscription.example["topic3-subscription1"] will be created
  + resource "azurerm_servicebus_subscription" "example" {
      + auto_delete_on_idle                       = (known after apply)
      + client_scoped_subscription_enabled        = false
      + dead_lettering_on_filter_evaluation_error = true
      + default_message_ttl                       = (known after apply)
      + id                                        = (known after apply)
      + lock_duration                             = (known after apply)
      + max_delivery_count                        = 1
      + name                                      = "topic3-subscription1"
      + status                                    = "Active"
      + topic_id                                  = (known after apply)
    }