Apply dynamic disks differently if name match expression

Had to deploy couple of rancher clusters on vsphere
code snippet terraform.tfvars

i have also 2 lists :
master_nodes = [“master101”,“master102”,“master103”]

worker_nodes = [“worker101”,“worker102”,“worker103”,“worker104”,“worker105”,“worker106”]

master_disks = [
{
number =1
size = 60
}]

worker_disks = [
{
number = 1
size = 100
},
{
number = 2
size = 150
}
]

main.tf

dynamic “disk” {
for_each = [
for d in var.worker_disks: d
if length(regexall(“worker.*”, each.value.name)) > 0
]
content {
label = “disk${disk.value[“number”]}”
size = disk.value[“size”]
unit_number = disk.value[“number”]
}
}

The above code works flawless adding dynamic disks fro worker nodes…
So basically:
for each master node deploy one disk, for each worker nodes deploy 2 more disks