Trouble with data source using for_each with Azure

Module vm
vm-main.tf

//Data source for the network interface
data "azurerm_network_interface" "citi_nic" {
  for_each            = var.citi_nic
  name                = each.value[name]
  resource_group_name = "rg-eastus-citi-01"
}
//Virtual machine resource
// Read in the Terraform doc to add more attributes as needed https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/virtual_machine
resource "azurerm_windows_virtual_machine" "citi_vm" {
  for_each            = var.citi_vm
  name                = each.value["name"]
  resource_group_name = each.value["resource_group_name"]
  location            = each.value["location"] != null ? each.value["location"] : data.azurerm_resource_group.citi_rg[each.value["name"]].location
  size                = each.value["size"]
  admin_username      = each.value["admin_username"]
  admin_password      = each.value["admin_password"]
  tags                = merge(data.azurerm_resource_group.citi_rg[each.value["name"]].tags, each.value["tags"])

  network_interface_ids = [for nic in data.azurerm_network_interface.citi_nic : "${nic.id}"]

  os_disk {
    caching              = each.value["caching"]
    storage_account_type = each.value["storage_account_type"]
    disk_size_gb = each.value["disk_size_gb"]
  }

  source_image_reference {
    publisher = each.value["publisher"]
    offer     = each.value["offer"]
    sku       = each.value["sku"]
    version   = each.value["version"]
  }

}

module nic
nic-main.tf

//Network interface 
//Map with for_each loop functions
resource "azurerm_network_interface" "citi_nic" {
  for_each            = var.citi_nic
  name                = each.value["name"]
  location            = lookup(each.value, "location", "eastus")
  resource_group_name = each.value["resource_group_name"]

  ip_configuration {
    name                          = "internal"
    subnet_id                     = data.azurerm_subnet.subnets[each.key].id
    private_ip_address_allocation = "Dynamic"
  }
  depends_on = [
    azurerm_subnet.subnets
  ]
}

The NIC was successfully deployed, but when I try to deploy the VM this is the error I get

  Error: Reference to undeclared input variable
│
│   on modules\vms\vm-main.tf line 10, in data "azurerm_network_interface" "citi_nic":
│   10:   for_each            = var.citi_nic
│
│ An input variable with the name "citi_nic" has not been declared. This variable can be declared with a variable "citi_nic" {} block.

Looks like you have two sets of code, one for NIC and one for VM.

variable citi_nic has been declared in the NIC module, but not defined in VM module.