Untitled

 avatar
stylingpanda
plain_text
2 months ago
660 B
5
Indexable
Never
locals {
  updated_users = [for user in var.users : {
    name     = user.name
    path     = user.path
    email    = user.email
    role     = user.role
    external = lookup(user, "external", length(regexall(".*@optus\\.com\\.au$", user.email)) == 0)
  }]

  externals = [for user in local.updated_users : user if user.external == true]
  internals = [for user in local.updated_users : user if user.external == false]

  externals_with_key = { for external in local.externals : "${external.email}-${external.path}" => external }
  internals_with_key = { for internal in local.internals : "${internal.email}-${internal.path}" => internal }

  debug = {
  }
}
Leave a Comment