-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support membership sync for org-team
- Loading branch information
Showing
4 changed files
with
57 additions
and
33 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
locals { | ||
members = [ | ||
for member in var.members : { | ||
username = member | ||
role = "member" | ||
} | ||
] | ||
maintainers = [ | ||
for maintainer in var.maintainers : { | ||
username = maintainer | ||
role = "maintainer" | ||
} | ||
] | ||
membership = concat(local.members, local.maintainers) | ||
} | ||
|
||
|
||
################################################### | ||
# Membership of GitHub Organization Team | ||
################################################### | ||
|
||
resource "github_team_membership" "this" { | ||
for_each = { | ||
for member in(!var.membership_sync_enabled ? local.membership : []) : | ||
member.username => member | ||
} | ||
|
||
team_id = github_team.this.id | ||
username = each.key | ||
role = each.value.role | ||
} | ||
|
||
resource "github_team_members" "some_team_members" { | ||
count = var.membership_sync_enabled ? 1 : 0 | ||
|
||
team_id = github_team.this.id | ||
|
||
dynamic "members" { | ||
for_each = local.membership | ||
iterator = member | ||
|
||
content { | ||
username = member.value.username | ||
role = member.value.role | ||
} | ||
} | ||
} |
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