How to use multiple keyvaults and use loops or for_each?

How do we convert output code to variable assignment e.g.

output "values" {
  value = {
    for k, s in data.azurerm_key_vault_secret.all : k => s.value
  }
  sensitive = true
}

to variable assignment:

module “mysql” {

users = {
for k, s in data.azurerm_key_vault_secret.all : k => s.value
}