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:
# 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
}
}
The following arguments are supported:
repository
- (Required) The GitHub repositoryuser
- (Optional) List of usersteam
- (Optional) List of teamsThe user
block supports:
username
- (Required) The user to add to the repository as a collaborator.permission
- (Optional) The permission of the outside collaborators for the repository.
Must be one of pull
, push
, maintain
, triage
or admin
or the name of an existing custom repository role within the organization for organization-owned repositories.
Must be push
for personal repositories. Defaults to push
.The team
block supports:
team_id
- (Required) The GitHub team id or the GitHub team slugpermission
- (Optional) The permission of the outside collaborators for the repository.
Must be one of pull
, triage
, push
, maintain
, admin
or the name of an existing custom repository role within the organisation. Defaults to pull
.
Must be push
for personal repositories. Defaults to push
.In addition to the above arguments, the following attributes are exported:
invitation_ids
- Map of usernames to invitation ID for any users added as part of creation of this resource to
be used in github_user_invitation_accepter
.GitHub Repository Collaborators can be imported using the name name
, e.g.
$ terraform import github_repository_collaborators.collaborators terraform