The full guide (including an explanation of the snippets) is available via operatehappy.com/managing-github-organizations-with-terraform.
Last active
January 31, 2020 13:21
-
-
Save operatehappy-bot/53710da90165c4b94737ac5411e4e4f7 to your computer and use it in GitHub Desktop.
Managing GitHub Organizations with Terraform
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
data "github_team" "internal" { | |
slug = "internal" | |
} |
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
resource "github_membership" "ksatirli" { | |
username = "ksatirli" | |
role = "admin" | |
} |
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
provider "github" { | |
token = "abc...890" | |
organization = "operatehappy" | |
version = "~> 2.2" | |
} |
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
resource "github_team_membership" "internal-ksatirli" { | |
team_id = data.github_team.internal.id | |
username = "ksatirli" | |
role = "maintainer" | |
} |
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
variable "internal_team_members" { | |
description = "Team Members of internal Team" | |
type = list(string) | |
default = [ | |
"operatehappy-bot", | |
"ksatirli", | |
] | |
} | |
resource "github_team_membership" "internal-team" { | |
count = length(var.internal_team_members) | |
team_id = github_team.internal.id | |
username = element(var.internal_team_members, count.index) | |
role = "maintainer" | |
} |
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
resource "github_team_membership" "internal-ksatirli" { | |
team_id = github_team.internal.id | |
username = "ksatirli" | |
role = "maintainer" | |
} |
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
resource "github_team" "internal" { | |
name = "internal" | |
description = "Internal Team" | |
privacy = "closed" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment