Creating 2 subnets in a vnet, based on the NIC naming subnet should be picked

I am creating 6 NICs, two NICs should get IP from subnet id 0 and another 4 NICs should receive IP from subnet id 1.

for that, I am using conditional expressions based on the name containing but it is saying false and all NIC’s receiving IP from subnet id 1.

Can someone please help me with this?

resource "azurerm_network_interface" "vm_nic" {
  for_each            = transpose(local.vm_names)
  name                = "${each.key}-NIC01"
  location            = azurerm_resource_group.rg.location
  resource_group_name = azurerm_resource_group.rg.name

  ip_configuration {
    name                          = "internal"
    subnet_id                     = "${local.vm_names == contains([local.vm_names], "RAW") ? module.network.subnet_id[0] : module.network.subnet_id[1]}"
    private_ip_address_allocation = "Dynamic"
  }

  depends_on = [module.network.subnet]
}

Here I added few validations from terraform console output.

> local.vm_names
{
  "DMG" = [
    "IND6WTSTDMG0801",
    "IND6WTSTDMG0802",
  ]
  "RAW" = [
    "IND6WTSTRAW0801",
    "IND6WTSTRAW0802",
  ]
  "RMA" = [
    "IND6WTSTRMA0801",
    "IND6WTSTRMA0802",
  ]
}
> transpose(local.vm_names)
tomap({
  "IND6WTSTDMG0801" = tolist([
    "DMG",
  ])
  "IND6WTSTDMG0802" = tolist([
    "DMG",
  ])
  "IND6WTSTRAW0801" = tolist([
    "RAW",
  ])
  "IND6WTSTRAW0802" = tolist([
    "RAW",
  ])
  "IND6WTSTRMA0801" = tolist([
    "RMA",
  ])
  "IND6WTSTRMA0802" = tolist([
    "RMA",
  ])
})
> contains([local.vm_names], "RAW")
false
>