Defining azurerm provider block using looping

Preparing terraform code to create service bus namespace and its configuration like topics etc.

Service bus and its topics configuration values will be inputed using yaml file, which contains all the configuration like its name, location, resouce group other configuration too.

Also service bus access is maintained on selected network only which required to provide list of ip address/ or subnet.

In input file there is block which represent list of subnet which need to be white listed as shown below, I am using a data block to reference those subnet in teraaform and then using it in service bus network rule set to white lis them.

Issue : As all the subnet is created on different subscription, I have to define different provider with its alias and need to use it in data block accordingly. But this information is comming from the input file so its not pre defined, also it might get changed over time means if it get run next time there might be few more subnet get added so I can not hard code provider block and then run it.

Is there a way I can define azurerm provider block using loop? same as I am defining data block for subnet. or any alternate work around which will be more generaic and not required hardcodeing in terraform code and can be maintain with input file.

subnet Input block from Yaml

subnets:
    - subnet_name: "App"
      vnet_name: "VNET1"
      resource_group_name: "NET-RG1"
      subscription_name: "SUB1" 
	  subscription_ID: "11111-1111-1111-1111111" 
	
	- subnet_name: "App2"
      vnet_name: "VNET2"
      resource_group_name: "NET-RG2"
      subscription_name: "SUB2" 
	  subscription_ID: "22222-22222222-222-222222"
data "azurerm_subnet" "subnets" {
	for_each             = { for idx, subnet in var.servicebus.subnets : idx => subnet }
	name                 = each.value.subnet_name
	virtual_network_name = each.value.vnet_name
	resource_group_name  = each.value.resource_group_name
}
resource "azurerm_servicebus_namespace_network_rule_set" "servicebus_netruleset" {
  namespace_id = azurerm_servicebus_namespace.servicebus.id
 
  default_action                = var.servicebus.default_action
  public_network_access_enabled = var.servicebus.public_network_access_enabled

  dynamic "network_rules" {
    for_each = { for each in data.azurerm_subnet.subnets : each.name => each }
    content {
      subnet_id                            = network_rules.value.id 
      ignore_missing_vnet_service_endpoint = false
    }
  }
  
  ip_rules = var.servicebus.ip_rules
}