A Terraform module for admin GitHub Account/Organization
These types of resources are supported:
- github_membership
- github_team
- github_team_membership
- github_repository
- github_branch
- branch_protection
- github_team_repository
Name | Version |
---|---|
terraform | >= 0.13.0 |
aws | ~> 3.0 |
Name | Version |
---|---|
Github | ~> 4.0.0 |
- Add member to the GitHub Account/Organization
- Asign member to Team
- Create Repositorie
- Define default branchs
- Define branch protection and restrictions.
- Create teams
- Add teams to repositories
github-membership
:
module "members" {
source = "github.com/FlexibilitySRL/terraform-github/modules/github-member"
admins = [ "maintainer", "admin-company" ]
commons = [ "developer", "customer", "tester", "ops" ]
}
github-team
:
module "parent_teams" {
source = "github.com/FlexibilitySRL/terraform-github/modules/github-team"
name = "Implementation"
description = "This is the description of the team"
members = [ "customer" ]
maintainers = [ "maintainer" ]
}
module "child_teams" {
source = "github.com/FlexibilitySRL/terraform-github/modules/github-team"
name = "Developer team"
parent_team_id = module.parent_teams["Implementation"].id
members = [ "developer", "tester" ]
maintainers = [ "maintainer" ]
depends_on = [
module.parent_teams
]
}
github-repository
:
module "repositories" {
source = "github.com/FlexibilitySRL/terraform-github/modules/github-repository"
name = "Repository name"
description = "Repository description"
visibility = "public"
branchs = [ "master" , "develop" ]
protection_branchs = {
master = {
required_approving_review_count = 2,
restrictions_teams = [ "ops", "maintainer" ]
},
release = {
required_approving_review_count = 1,
restrictions_teams = [ "ops" ]
}
}
}
github-team-repository
:
module "team_repository" {
source = "github.com/FlexibilitySRL/terraform-github/modules/github-team-repository"
team_id = module.parent_teams["implementation"].id
admins = [ "maintainer" ]
pushs = [ "developer" ]
pulls = [ "tester" ]
maintainers = [ "maintainer" ]
}
NOTE: In order to use the GitHub module it's necessary to config the Terraform GitHub Provider:
#=============================#
# GITHUB Provider Settings #
#=============================#
provider "github" {
token = [GITHUB_ACCESS_TOKEN]
organization = [GITHUB_ORGANIZATION]
version = "~> 3.0.0"
}
Use github-membership module module to add github members to company.
Use github-team module module to create Teams and add members and maintainers.
Use github-repository module module to create one or many repositories and create its branches and protect or not that branches.
Use github-team-repository module module to add a relationship between repositories and teams.
- github-membership - Create a github member
- github-team - Create a team and add one member and one maintainer
- github-repository - Create a repository with two branches and add a protect in one of that branches
- github-team-repository - Add a relationship between team and repository
Module managed by Flexibility.
MIT License. See LICENSE for full details.