mineiros-io / terraform-github-organization

A Terraform module to manage GitHub Organizations. https://github.com/
Apache License 2.0
60 stars 14 forks source link

Members and Admins #53

Open unique-dominik opened 1 year ago

unique-dominik commented 1 year ago

Issue

admins = {
  "admin"   = "admin"
}

team_a = {
  "admin" = "admin"
}

merge(
  local.team_a,
  ...
)

Question

Sorry to bother, I see you actually have like no issues but I am stuck (in my head I assume). How am I supposed to model that an admin is also a member? Or shall I just let GH handle membership? If I appoint an admin as member, his member state always wins. Maybe I am just blind. But the teams we then need in the repo module of yours to assign push permissions.

What am I understanding wrong?

samuelb commented 5 months ago

We solved it like this:

locals {
  admins = ["peter", "mary"]
  teams = {
    ops = {
      members = ["peter", "paul"]
      # [...]
    }
    devs = {
      members = ["mary", "mike"]
      # [...]
    }
  }
}

module "organization" {
  source  = "mineiros-io/organization/github"
  admins  = local.admins
  members = setsubtract(flatten(local.teams[*].members), local.admins) # admins can't be regular members
}