github_team_members

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.

Example Usage

# 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"
  }
}

Argument Reference

The following arguments are supported:

Members

members supports the following arguments:

Import

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