For_each module with jsondecode

I wanted to provide an update. I changed this around and I don’t really like it, however for_each does not appear to like tuples. My question now, is there a better way to decodejson into a map instead of dealing with the tuple?

Here is the change to resolve the tuple / for_each issue

topics.tf

provider "azurerm" {
  version  = "=2.20.0"
  subscription_id   = "X"
  features {}
}
locals {
  json_data = jsondecode(file("../Topics/Topicfile.json"))
}

module "Demo" {
  for_each = { for t in local.json_data.publishes : t.topicName => t }
  source    = "../modules/azurerm_servicebus_topic"
  asb-name  = "asb-dev-namespace1"
  asb-topic = each.value.topicName
  resourcegroup = "dev-rg-servicebus-eastus2"
}