1. Packages
  2. Github Provider
  3. API Docs
  4. TeamRepository
GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi

github.TeamRepository

Explore with Pulumi AI

github logo
GitHub v6.3.2 published on Friday, Oct 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("some_team", {
        name: "SomeTeam",
        description: "Some cool team",
    });
    const someRepo = new github.Repository("some_repo", {name: "some-repo"});
    const someTeamRepo = new github.TeamRepository("some_team_repo", {
        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("some_team",
        name="SomeTeam",
        description="Some cool team")
    some_repo = github.Repository("some_repo", name="some-repo")
    some_team_repo = github.TeamRepository("some_team_repo",
        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, "some_team", &github.TeamArgs{
    			Name:        pulumi.String("SomeTeam"),
    			Description: pulumi.String("Some cool team"),
    		})
    		if err != nil {
    			return err
    		}
    		someRepo, err := github.NewRepository(ctx, "some_repo", &github.RepositoryArgs{
    			Name: pulumi.String("some-repo"),
    		})
    		if err != nil {
    			return err
    		}
    		_, err = github.NewTeamRepository(ctx, "some_team_repo", &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("some_team", new()
        {
            Name = "SomeTeam",
            Description = "Some cool team",
        });
    
        var someRepo = new Github.Repository("some_repo", new()
        {
            Name = "some-repo",
        });
    
        var someTeamRepo = new Github.TeamRepository("some_team_repo", 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.RepositoryArgs;
    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) {
            // Add a repository to the team
            var someTeam = new Team("someTeam", TeamArgs.builder()
                .name("SomeTeam")
                .description("Some cool team")
                .build());
    
            var someRepo = new Repository("someRepo", RepositoryArgs.builder()
                .name("some-repo")
                .build());
    
            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
        name: some_team
        properties:
          name: SomeTeam
          description: Some cool team
      someRepo:
        type: github:Repository
        name: some_repo
        properties:
          name: some-repo
      someTeamRepo:
        type: github:TeamRepository
        name: some_team_repo
        properties:
          teamId: ${someTeam.id}
          repository: ${someRepo.name}
          permission: pull
    

    Create TeamRepository Resource

    Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.

    Constructor syntax

    new TeamRepository(name: string, args: TeamRepositoryArgs, opts?: CustomResourceOptions);
    @overload
    def TeamRepository(resource_name: str,
                       args: TeamRepositoryArgs,
                       opts: Optional[ResourceOptions] = None)
    
    @overload
    def TeamRepository(resource_name: str,
                       opts: Optional[ResourceOptions] = None,
                       repository: Optional[str] = None,
                       team_id: Optional[str] = None,
                       permission: Optional[str] = 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.
    
    

    Parameters

    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.

    Constructor example

    The following reference example uses placeholder values for all input properties.

    var teamRepositoryResource = new Github.TeamRepository("teamRepositoryResource", new()
    {
        Repository = "string",
        TeamId = "string",
        Permission = "string",
    });
    
    example, err := github.NewTeamRepository(ctx, "teamRepositoryResource", &github.TeamRepositoryArgs{
    	Repository: pulumi.String("string"),
    	TeamId:     pulumi.String("string"),
    	Permission: pulumi.String("string"),
    })
    
    var teamRepositoryResource = new TeamRepository("teamRepositoryResource", TeamRepositoryArgs.builder()
        .repository("string")
        .teamId("string")
        .permission("string")
        .build());
    
    team_repository_resource = github.TeamRepository("teamRepositoryResource",
        repository="string",
        team_id="string",
        permission="string")
    
    const teamRepositoryResource = new github.TeamRepository("teamRepositoryResource", {
        repository: "string",
        teamId: "string",
        permission: "string",
    });
    
    type: github:TeamRepository
    properties:
        permission: string
        repository: string
        teamId: string
    

    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

    In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.

    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
    

    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.
    github logo
    GitHub v6.3.2 published on Friday, Oct 11, 2024 by Pulumi