github.RepositoryCollaborator
Explore with Pulumi AI
Provides a GitHub repository collaborator resource.
Note: github.RepositoryCollaborator cannot be used in conjunction with github.RepositoryCollaborators or they will fight over what your policy should be.
This resource allows you to add/remove collaborators from 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 collaborator on a repository. When destroyed, either the invitation will be cancelled or the collaborator will be removed from the repository.
This resource is non-authoritative, for managing ALL collaborators of a repo, use github.RepositoryCollaborators instead.
Further documentation on GitHub collaborators:
- Adding outside collaborators to your personal repositories
- Adding outside collaborators to repositories in your organization
- Converting an organization member to an outside collaborator
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as github from "@pulumi/github";
// Add a collaborator to a repository
const aRepoCollaborator = new github.RepositoryCollaborator("a_repo_collaborator", {
repository: "our-cool-repo",
username: "SomeUser",
permission: "admin",
});
import pulumi
import pulumi_github as github
# Add a collaborator to a repository
a_repo_collaborator = github.RepositoryCollaborator("a_repo_collaborator",
repository="our-cool-repo",
username="SomeUser",
permission="admin")
package main
import (
"github.com/pulumi/pulumi-github/sdk/v6/go/github"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
// Add a collaborator to a repository
_, err := github.NewRepositoryCollaborator(ctx, "a_repo_collaborator", &github.RepositoryCollaboratorArgs{
Repository: pulumi.String("our-cool-repo"),
Username: pulumi.String("SomeUser"),
Permission: pulumi.String("admin"),
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Github = Pulumi.Github;
return await Deployment.RunAsync(() =>
{
// Add a collaborator to a repository
var aRepoCollaborator = new Github.RepositoryCollaborator("a_repo_collaborator", new()
{
Repository = "our-cool-repo",
Username = "SomeUser",
Permission = "admin",
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.github.RepositoryCollaborator;
import com.pulumi.github.RepositoryCollaboratorArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
// Add a collaborator to a repository
var aRepoCollaborator = new RepositoryCollaborator("aRepoCollaborator", RepositoryCollaboratorArgs.builder()
.repository("our-cool-repo")
.username("SomeUser")
.permission("admin")
.build());
}
}
resources:
# Add a collaborator to a repository
aRepoCollaborator:
type: github:RepositoryCollaborator
name: a_repo_collaborator
properties:
repository: our-cool-repo
username: SomeUser
permission: admin
Create RepositoryCollaborator Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new RepositoryCollaborator(name: string, args: RepositoryCollaboratorArgs, opts?: CustomResourceOptions);
@overload
def RepositoryCollaborator(resource_name: str,
args: RepositoryCollaboratorArgs,
opts: Optional[ResourceOptions] = None)
@overload
def RepositoryCollaborator(resource_name: str,
opts: Optional[ResourceOptions] = None,
repository: Optional[str] = None,
username: Optional[str] = None,
permission: Optional[str] = None,
permission_diff_suppression: Optional[bool] = None)
func NewRepositoryCollaborator(ctx *Context, name string, args RepositoryCollaboratorArgs, opts ...ResourceOption) (*RepositoryCollaborator, error)
public RepositoryCollaborator(string name, RepositoryCollaboratorArgs args, CustomResourceOptions? opts = null)
public RepositoryCollaborator(String name, RepositoryCollaboratorArgs args)
public RepositoryCollaborator(String name, RepositoryCollaboratorArgs args, CustomResourceOptions options)
type: github:RepositoryCollaborator
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args RepositoryCollaboratorArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args RepositoryCollaboratorArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args RepositoryCollaboratorArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args RepositoryCollaboratorArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args RepositoryCollaboratorArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var repositoryCollaboratorResource = new Github.RepositoryCollaborator("repositoryCollaboratorResource", new()
{
Repository = "string",
Username = "string",
Permission = "string",
PermissionDiffSuppression = false,
});
example, err := github.NewRepositoryCollaborator(ctx, "repositoryCollaboratorResource", &github.RepositoryCollaboratorArgs{
Repository: pulumi.String("string"),
Username: pulumi.String("string"),
Permission: pulumi.String("string"),
PermissionDiffSuppression: pulumi.Bool(false),
})
var repositoryCollaboratorResource = new RepositoryCollaborator("repositoryCollaboratorResource", RepositoryCollaboratorArgs.builder()
.repository("string")
.username("string")
.permission("string")
.permissionDiffSuppression(false)
.build());
repository_collaborator_resource = github.RepositoryCollaborator("repositoryCollaboratorResource",
repository="string",
username="string",
permission="string",
permission_diff_suppression=False)
const repositoryCollaboratorResource = new github.RepositoryCollaborator("repositoryCollaboratorResource", {
repository: "string",
username: "string",
permission: "string",
permissionDiffSuppression: false,
});
type: github:RepositoryCollaborator
properties:
permission: string
permissionDiffSuppression: false
repository: string
username: string
RepositoryCollaborator Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The RepositoryCollaborator resource accepts the following input properties:
- Repository string
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- Username string
- The user to add to the repository as a collaborator.
- Permission string
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - Permission
Diff boolSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
.
- Repository string
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- Username string
- The user to add to the repository as a collaborator.
- Permission string
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - Permission
Diff boolSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
.
- repository String
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- username String
- The user to add to the repository as a collaborator.
- permission String
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - permission
Diff BooleanSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
.
- repository string
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- username string
- The user to add to the repository as a collaborator.
- permission string
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - permission
Diff booleanSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
.
- repository str
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- username str
- The user to add to the repository as a collaborator.
- permission str
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - permission_
diff_ boolsuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
.
- repository String
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- username String
- The user to add to the repository as a collaborator.
- permission String
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - permission
Diff BooleanSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
.
Outputs
All input properties are implicitly available as output properties. Additionally, the RepositoryCollaborator resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Invitation
Id string - ID of the invitation to be used in
github.UserInvitationAccepter
- Id string
- The provider-assigned unique ID for this managed resource.
- Invitation
Id string - ID of the invitation to be used in
github.UserInvitationAccepter
- id String
- The provider-assigned unique ID for this managed resource.
- invitation
Id String - ID of the invitation to be used in
github.UserInvitationAccepter
- id string
- The provider-assigned unique ID for this managed resource.
- invitation
Id string - ID of the invitation to be used in
github.UserInvitationAccepter
- id str
- The provider-assigned unique ID for this managed resource.
- invitation_
id str - ID of the invitation to be used in
github.UserInvitationAccepter
- id String
- The provider-assigned unique ID for this managed resource.
- invitation
Id String - ID of the invitation to be used in
github.UserInvitationAccepter
Look up Existing RepositoryCollaborator Resource
Get an existing RepositoryCollaborator resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: RepositoryCollaboratorState, opts?: CustomResourceOptions): RepositoryCollaborator
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
invitation_id: Optional[str] = None,
permission: Optional[str] = None,
permission_diff_suppression: Optional[bool] = None,
repository: Optional[str] = None,
username: Optional[str] = None) -> RepositoryCollaborator
func GetRepositoryCollaborator(ctx *Context, name string, id IDInput, state *RepositoryCollaboratorState, opts ...ResourceOption) (*RepositoryCollaborator, error)
public static RepositoryCollaborator Get(string name, Input<string> id, RepositoryCollaboratorState? state, CustomResourceOptions? opts = null)
public static RepositoryCollaborator get(String name, Output<String> id, RepositoryCollaboratorState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Invitation
Id string - ID of the invitation to be used in
github.UserInvitationAccepter
- Permission string
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - Permission
Diff boolSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
. - Repository string
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- Username string
- The user to add to the repository as a collaborator.
- Invitation
Id string - ID of the invitation to be used in
github.UserInvitationAccepter
- Permission string
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - Permission
Diff boolSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
. - Repository string
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- Username string
- The user to add to the repository as a collaborator.
- invitation
Id String - ID of the invitation to be used in
github.UserInvitationAccepter
- permission String
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - permission
Diff BooleanSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
. - repository String
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- username String
- The user to add to the repository as a collaborator.
- invitation
Id string - ID of the invitation to be used in
github.UserInvitationAccepter
- permission string
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - permission
Diff booleanSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
. - repository string
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- username string
- The user to add to the repository as a collaborator.
- invitation_
id str - ID of the invitation to be used in
github.UserInvitationAccepter
- permission str
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - permission_
diff_ boolsuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
. - repository str
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- username str
- The user to add to the repository as a collaborator.
- invitation
Id String - ID of the invitation to be used in
github.UserInvitationAccepter
- permission String
- The permission of the outside collaborator for the repository.
Must be one of
pull
,push
,maintain
,triage
oradmin
or the name of an existing custom repository role within the organization for organization-owned repositories. Must bepush
for personal repositories. Defaults topush
. - permission
Diff BooleanSuppression - Suppress plan diffs for
triage
andmaintain
. Defaults tofalse
. - repository String
The GitHub repository
Note: The owner of the repository can be passed as part of the repository name e.g.
owner-org-name/repo-name
. If owner is not supplied as part of the repository name, it may also be supplied by setting the environment variableGITHUB_OWNER
.- username String
- The user to add to the repository as a collaborator.
Import
GitHub Repository Collaborators can be imported using an ID made up of repository:username
, e.g.
$ pulumi import github:index/repositoryCollaborator:RepositoryCollaborator collaborator terraform:someuser
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- GitHub pulumi/pulumi-github
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
github
Terraform Provider.