Created
November 10, 2021 07:53
-
-
Save koozz/e401d1a0041e1d1ebabcd70aac239349 to your computer and use it in GitHub Desktop.
Teams-as-Code service snippet
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
locals { | |
# List users by their key | |
tac_users = { | |
for user in var.users : lower(user.key) => user | |
} | |
# List teams with the users that have this team defined in their teams block | |
tac_teams = { | |
for team in var.teams : lower(team.name) => [ | |
for key, user in local.tac_users : key if contains((user.teams == null ? [] : user.teams), lower(team.name)) | |
] | |
} | |
} | |
# Teams to single constructs of AD group with matching GitHub team and sync. | |
module "teams" { | |
source = "../../modules/team-as-code" | |
for_each = local.tac_teams | |
slug = each.key | |
members = each.value == null ? [] : [for member in each.value : "${member}@${var.user_ad_domain}"] | |
prefix = var.team_ad_prefix | |
parent = var.github_parent_team | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment