1. Packages
  2. GitHub
  3. API Docs
  4. TeamRepository
GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi

github.TeamRepository

Explore with Pulumi AI

github logo
GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi

    Note: github.TeamRepository cannot be used in conjunction with github.RepositoryCollaborators or they will fight over what your policy should be.

    This resource manages relationships between teams and repositories in your GitHub organization.

    Creating this resource grants a particular team permissions on a particular repository.

    The repository and the team must both belong to the same organization on GitHub. This resource does not actually create any repositories; to do that, see github.Repository.

    This resource is non-authoritative, for managing ALL collaborators of a repo, use github.RepositoryCollaborators instead.

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as github from "@pulumi/github";
    
    // Add a repository to the team
    const someTeam = new github.Team("someTeam", {description: "Some cool team"});
    const someRepo = new github.Repository("someRepo", {});
    const someTeamRepo = new github.TeamRepository("someTeamRepo", {
        teamId: someTeam.id,
        repository: someRepo.name,
        permission: "pull",
    });
    
    import pulumi
    import pulumi_github as github
    
    # Add a repository to the team
    some_team = github.Team("someTeam", description="Some cool team")
    some_repo = github.Repository("someRepo")
    some_team_repo = github.TeamRepository("someTeamRepo",
        team_id=some_team.id,
        repository=some_repo.name,
        permission="pull")
    
    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 repository to the team
    		someTeam, err := github.NewTeam(ctx, "someTeam", &github.TeamArgs{
    			Description: pulumi.String("Some cool team"),
    		})
    		if err != nil {
    			return err
    		}
    		someRepo, err := github.NewRepository(ctx, "someRepo", nil)
    		if err != nil {
    			return err
    		}
    		_, err = github.NewTeamRepository(ctx, "someTeamRepo", &github.TeamRepositoryArgs{
    			TeamId:     someTeam.ID(),
    			Repository: someRepo.Name,
    			Permission: pulumi.String("pull"),
    		})
    		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 repository to the team
        var someTeam = new Github.Team("someTeam", new()
        {
            Description = "Some cool team",
        });
    
        var someRepo = new Github.Repository("someRepo");
    
        var someTeamRepo = new Github.TeamRepository("someTeamRepo", new()
        {
            TeamId = someTeam.Id,
            Repository = someRepo.Name,
            Permission = "pull",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.github.Team;
    import com.pulumi.github.TeamArgs;
    import com.pulumi.github.Repository;
    import com.pulumi.github.TeamRepository;
    import com.pulumi.github.TeamRepositoryArgs;
    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) {
            var someTeam = new Team("someTeam", TeamArgs.builder()        
                .description("Some cool team")
                .build());
    
            var someRepo = new Repository("someRepo");
    
            var someTeamRepo = new TeamRepository("someTeamRepo", TeamRepositoryArgs.builder()        
                .teamId(someTeam.id())
                .repository(someRepo.name())
                .permission("pull")
                .build());
    
        }
    }
    
    resources:
      # Add a repository to the team
      someTeam:
        type: github:Team
        properties:
          description: Some cool team
      someRepo:
        type: github:Repository
      someTeamRepo:
        type: github:TeamRepository
        properties:
          teamId: ${someTeam.id}
          repository: ${someRepo.name}
          permission: pull
    

    Create TeamRepository Resource

    new TeamRepository(name: string, args: TeamRepositoryArgs, opts?: CustomResourceOptions);
    @overload
    def TeamRepository(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       permission: Optional[str] = None,
                       repository: Optional[str] = None,
                       team_id: Optional[str] = None)
    @overload
    def TeamRepository(resource_name: str,
                       args: TeamRepositoryArgs,
                       opts: Optional[ResourceOptions] = None)
    func NewTeamRepository(ctx *Context, name string, args TeamRepositoryArgs, opts ...ResourceOption) (*TeamRepository, error)
    public TeamRepository(string name, TeamRepositoryArgs args, CustomResourceOptions? opts = null)
    public TeamRepository(String name, TeamRepositoryArgs args)
    public TeamRepository(String name, TeamRepositoryArgs args, CustomResourceOptions options)
    
    type: github:TeamRepository
    properties: # The arguments to resource properties.
    options: # Bag of options to control resource's behavior.
    
    
    name string
    The unique name of the resource.
    args TeamRepositoryArgs
    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 TeamRepositoryArgs
    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 TeamRepositoryArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args TeamRepositoryArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args TeamRepositoryArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    TeamRepository 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 TeamRepository resource accepts the following input properties:

    Repository string
    The repository to add to the team.
    TeamId string
    The GitHub team id or the GitHub team slug
    Permission string
    The permissions of team members regarding 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.
    Repository string
    The repository to add to the team.
    TeamId string
    The GitHub team id or the GitHub team slug
    Permission string
    The permissions of team members regarding 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.
    repository String
    The repository to add to the team.
    teamId String
    The GitHub team id or the GitHub team slug
    permission String
    The permissions of team members regarding 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.
    repository string
    The repository to add to the team.
    teamId string
    The GitHub team id or the GitHub team slug
    permission string
    The permissions of team members regarding 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.
    repository str
    The repository to add to the team.
    team_id str
    The GitHub team id or the GitHub team slug
    permission str
    The permissions of team members regarding 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.
    repository String
    The repository to add to the team.
    teamId String
    The GitHub team id or the GitHub team slug
    permission String
    The permissions of team members regarding 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.

    Outputs

    All input properties are implicitly available as output properties. Additionally, the TeamRepository resource produces the following output properties:

    Etag string
    Id string
    The provider-assigned unique ID for this managed resource.
    Etag string
    Id string
    The provider-assigned unique ID for this managed resource.
    etag String
    id String
    The provider-assigned unique ID for this managed resource.
    etag string
    id string
    The provider-assigned unique ID for this managed resource.
    etag str
    id str
    The provider-assigned unique ID for this managed resource.
    etag String
    id String
    The provider-assigned unique ID for this managed resource.

    Look up Existing TeamRepository Resource

    Get an existing TeamRepository 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?: TeamRepositoryState, opts?: CustomResourceOptions): TeamRepository
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            etag: Optional[str] = None,
            permission: Optional[str] = None,
            repository: Optional[str] = None,
            team_id: Optional[str] = None) -> TeamRepository
    func GetTeamRepository(ctx *Context, name string, id IDInput, state *TeamRepositoryState, opts ...ResourceOption) (*TeamRepository, error)
    public static TeamRepository Get(string name, Input<string> id, TeamRepositoryState? state, CustomResourceOptions? opts = null)
    public static TeamRepository get(String name, Output<String> id, TeamRepositoryState 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.
    The following state arguments are supported:
    Etag string
    Permission string
    The permissions of team members regarding 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.
    Repository string
    The repository to add to the team.
    TeamId string
    The GitHub team id or the GitHub team slug
    Etag string
    Permission string
    The permissions of team members regarding 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.
    Repository string
    The repository to add to the team.
    TeamId string
    The GitHub team id or the GitHub team slug
    etag String
    permission String
    The permissions of team members regarding 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.
    repository String
    The repository to add to the team.
    teamId String
    The GitHub team id or the GitHub team slug
    etag string
    permission string
    The permissions of team members regarding 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.
    repository string
    The repository to add to the team.
    teamId string
    The GitHub team id or the GitHub team slug
    etag str
    permission str
    The permissions of team members regarding 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.
    repository str
    The repository to add to the team.
    team_id str
    The GitHub team id or the GitHub team slug
    etag String
    permission String
    The permissions of team members regarding 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.
    repository String
    The repository to add to the team.
    teamId String
    The GitHub team id or the GitHub team slug

    Import

    GitHub Team Repository can be imported using an ID made up of team_id:repository or team_name:repository, e.g.

    $ pulumi import github:index/teamRepository:TeamRepository terraform_repo 1234567:terraform
    
    $ pulumi import github:index/teamRepository:TeamRepository terraform_repo Administrators:terraform
    

    Package Details

    Repository
    GitHub pulumi/pulumi-github
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the github Terraform Provider.
    github logo
    GitHub v6.1.0 published on Monday, Mar 11, 2024 by Pulumi