github_repository_collaborators

Provides a GitHub repository collaborators resource.

This resource allows you to manage all collaborators for repositories in your organization or personal account. For organization repositories, collaborators can have explicit (and differing levels of) read, write, or administrator access to specific repositories, without giving the user full organization membership. For personal repositories, collaborators can only be granted write (implicitly includes read) permission.

When applied, an invitation will be sent to the user to become a collaborators on a repository. When destroyed, either the invitation will be cancelled or the collaborators will be removed from the repository.

This resource is authoritative. For adding a collaborator to a repo in a non-authoritative manner, use github_repository_collaborator instead.

Further documentation on GitHub collaborators:

Example Usage

# Add collaborators to a repository
resource "github_team" "some_team" {
  name        = "SomeTeam"
  description = "Some cool team"
}

resource "github_repository" "some_repo" {
  name = "some-repo"
}

resource "github_repository_collaborators" "some_repo_collaborators" {
  repository = github_repository.some_repo.name

  user {
    permission = "admin"
    username  = "SomeUser"
  }

  team {
    permission = "pull"
    team_id = github_team.some_team.slug
  }
}

Argument Reference

The following arguments are supported:

The user block supports:

The team block supports:

Attribute Reference

In addition to the above arguments, the following attributes are exported:

Import

GitHub Repository Collaborators can be imported using the name name, e.g.

$ terraform import github_repository_collaborators.collaborators terraform