Terraform module to create GitHub teams and team memberships.
This module ships with a root module that allows you to create a list of teams (including child teams) and their corresponding association. You can however also just use the bundled sub-modules and wrap your own root module around.
The following must be taken into consideration for initial creation or on re-creation (update operations are not affected):
- This module will not work when using
terraform apply -parallelism=1
. It must be run in parallel (as is by default). - When you have a lot of teams (>50) including multiple nesting levels (>2), it is strongly advised to bump parallelism to a higher value:
terraform apply -parallelism=50
to avoid child teams not being able to find parents. - If an increase in parallelism still does not help, you should first define and apply parent teams and then continue with each level. Alternatively you can apply multiple times until it will eventually succeed.
This module provides the following features without having to re-create teams in a single run as it is able to handle parent/child dependencies automatically:
- Create stand-alone teams
- Create nested teams
- Add member association
- Allows for moving teams up/down a level teams
- Allow for changing team names
The following has been extensively tested with this module
- terraform apply from scratch
- terraform destroy
- terraform apply with a stand-alone team renamed
- terraform apply with a parent team renamed team renamed
- terraform apply with moving a stand-alone team one level up
- terraform apply with moving a team (which contains childs) one level up
teams = [
{
ident = "devops" # The 'ident' is a unique ident to allow restructuring without team re-creation
name = "DevOps"
description = "The DevOps Team"
privacy = "secret"
members = ["cytopia"]
},
{
ident = "engineering"
name = "Engineering"
description = "The Engineering Team"
members = ["cytopia"]
},
{
ident = "frontend"
name = "Frontend"
description = "Team Frontend"
parent_name = "Engineering"
},
{
ident = "backend"
name = "Backend"
description = "Team Backend"
parent_name = "Engineering"
},
]
No providers.
Name | Version |
---|---|
terraform | >= 1.3 |
github | 6.4.0-fl.1 |
The following input variables are required:
Description: GitHub teams to manage.
Type:
list(object({
ident = string # Unique identifier for each item to guarantee no re-create during list change
name = string # Name of the team as displayed on GitHub
description = optional(string) # Description of the team
privacy = optional(string, "closed") # Privacy (closed or secret), default is closed
parent_name = optional(string) # Name of the Parent team
members = optional(list(string), []) # List of GitHub usernames to assign to a team
}))
No optional inputs.
Name | Description |
---|---|
teams | GitHub teams. |
Copyright (c) 2022 Flaconi GmbH