Skip to content

notablehealth/terraform-github-teams

Repository files navigation

terraform-github-teams

Releases

Terraform Module Registry

Terraform module to manage GitHub teams

Requirements

  • GitHub personal access token with admin rights to an organization
    • Provide token via environment variable

    export GITHUB_TOKEN='TOKEN'

Features

  • Manage GitHub teams
    • Manage nested teams (currently 4 levels)
  • Manage team members

Terraform doesn't handle dynamic recursion or resource dependencies. To do nested teams, the code would either need to be run multiple times or manage a fixed maximum number of levels. This module manages up to 4 levels of nesting. But could easily be expanded to more.

Usage

Basic usage of this module is as follows:

module "example" {
    source = "notablehealth/<module-name>/github"
    # Recommend pinning every module to a specific version
    # version = "x.x.x"

    # Required variables
    github_owner =
}

Requirements

Name Version
terraform >= 1.5
github ~> 6.3

Providers

Name Version
github 5.29.0

Modules

No modules.

Resources

Name Type
github_team.teams_level2 resource
github_team.teams_level3 resource
github_team.teams_level4 resource
github_team.teams_root resource
github_team_members.self resource
github_team_repository.self resource
github_team_settings.self resource

Inputs

Name Description Type Default Required
github_owner GitHub organization string n/a yes
teams GitHub Team configuration objects
map(object({
name = string
description = string
privacy = optional(string, "closed")
parent_team = optional(string)
members = optional(list(object({
full_name = optional(string)
username = string
role = optional(string, "member")
})))
repository = optional(object({
name = string
permission = optional(string, "pull")
}))
review_request_delegation = optional(object({
algorithm = optional(string, "ROUND_ROBIN")
member_count = optional(number)
notify = optional(bool)
}))
}))
{} no

Outputs

Name Description
repositories Team repository permissions
teams_level2 GitHub level 2 teams
teams_level3 GitHub level 3 teams
teams_level4 GitHub level 4 teams
teams_root GitHub root level teams