Provides a GitHub team members resource.
This resource allows you to manage members of teams in your organization. It sets the requested team members for the team and removes all users not managed by Terraform.
When applied, if the user hasn't accepted their invitation to the organization, they won't be part of the team until they do.
When destroyed, all users will be removed from the team.
# Add a user to the organization
resource "github_membership" "membership_for_some_user" {
username = "SomeUser"
role = "member"
}
resource "github_membership" "membership_for_another_user" {
username = "AnotherUser"
role = "member"
}
resource "github_team" "some_team" {
name = "SomeTeam"
description = "Some cool team"
}
resource "github_team_members" "some_team_members" {
team_id = github_team.some_team.id
members {
username = "SomeUser"
role = "maintainer"
}
members {
username = "AnotherUser"
role = "member"
}
}
The following arguments are supported:
team_id
- (Required) The team id or the team slugmembers
- (Required) List of team members. See Members below for details.members
supports the following arguments:
username
- (Required) The user to add to the team.role
- (Optional) The role of the user within the team.
Must be one of member
or maintainer
. Defaults to member
.GitHub Team Membership can be imported using the team ID team id or team slug, e.g.
$ terraform import github_team_members.some_team 1234567
$ terraform import github_team_members.some_team Administrators