1. Packages
  2. AzureDevOps
  3. API Docs
  4. Git
Azure DevOps v3.0.0 published on Friday, Mar 15, 2024 by Pulumi

azuredevops.Git

Explore with Pulumi AI

azuredevops logo
Azure DevOps v3.0.0 published on Friday, Mar 15, 2024 by Pulumi

    Import

    Azure DevOps Repositories can be imported using the repo name or by the repo Guid e.g.

    $ pulumi import azuredevops:index/git:Git example projectName/repoName
    

    or

    $ pulumi import azuredevops:index/git:Git example projectName/00000000-0000-0000-0000-000000000000
    

    hcl

    resource “azuredevops_project” “example” {

    name = “Example Project”

    visibility = “private”

    version_control = “Git”

    work_item_template = “Agile”

    }

    resource “azuredevops_git_repository” “example” {

    project_id = azuredevops_project.example.id

    name = “Example Git Repository”

    default_branch = “refs/heads/main”

    initialization {

    init_type = "Clean"
    

    }

    lifecycle {

    ignore_changes = [
    
      # Ignore changes to initialization to support importing existing repositories
    
      # Given that a repo now exists, either imported into terraform state or created by terraform,
    
      # we don't care for the configuration of initialization against the existing resource
    
      initialization,
    
    ]
    

    }

    }

    Create Git Resource

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

    Constructor syntax

    new Git(name: string, args: GitArgs, opts?: CustomResourceOptions);
    @overload
    def Git(resource_name: str,
            args: GitArgs,
            opts: Optional[ResourceOptions] = None)
    
    @overload
    def Git(resource_name: str,
            opts: Optional[ResourceOptions] = None,
            initialization: Optional[GitInitializationArgs] = None,
            project_id: Optional[str] = None,
            default_branch: Optional[str] = None,
            name: Optional[str] = None,
            parent_repository_id: Optional[str] = None)
    func NewGit(ctx *Context, name string, args GitArgs, opts ...ResourceOption) (*Git, error)
    public Git(string name, GitArgs args, CustomResourceOptions? opts = null)
    public Git(String name, GitArgs args)
    public Git(String name, GitArgs args, CustomResourceOptions options)
    
    type: azuredevops:Git
    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 GitArgs
    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 GitArgs
    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 GitArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args GitArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args GitArgs
    The arguments to resource properties.
    options CustomResourceOptions
    Bag of options to control resource's behavior.

    Example

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

    var gitResource = new AzureDevOps.Git("gitResource", new()
    {
        Initialization = new AzureDevOps.Inputs.GitInitializationArgs
        {
            InitType = "string",
            ServiceConnectionId = "string",
            SourceType = "string",
            SourceUrl = "string",
        },
        ProjectId = "string",
        DefaultBranch = "string",
        Name = "string",
        ParentRepositoryId = "string",
    });
    
    example, err := azuredevops.NewGit(ctx, "gitResource", &azuredevops.GitArgs{
    	Initialization: &azuredevops.GitInitializationArgs{
    		InitType:            pulumi.String("string"),
    		ServiceConnectionId: pulumi.String("string"),
    		SourceType:          pulumi.String("string"),
    		SourceUrl:           pulumi.String("string"),
    	},
    	ProjectId:          pulumi.String("string"),
    	DefaultBranch:      pulumi.String("string"),
    	Name:               pulumi.String("string"),
    	ParentRepositoryId: pulumi.String("string"),
    })
    
    var gitResource = new Git("gitResource", GitArgs.builder()        
        .initialization(GitInitializationArgs.builder()
            .initType("string")
            .serviceConnectionId("string")
            .sourceType("string")
            .sourceUrl("string")
            .build())
        .projectId("string")
        .defaultBranch("string")
        .name("string")
        .parentRepositoryId("string")
        .build());
    
    git_resource = azuredevops.Git("gitResource",
        initialization=azuredevops.GitInitializationArgs(
            init_type="string",
            service_connection_id="string",
            source_type="string",
            source_url="string",
        ),
        project_id="string",
        default_branch="string",
        name="string",
        parent_repository_id="string")
    
    const gitResource = new azuredevops.Git("gitResource", {
        initialization: {
            initType: "string",
            serviceConnectionId: "string",
            sourceType: "string",
            sourceUrl: "string",
        },
        projectId: "string",
        defaultBranch: "string",
        name: "string",
        parentRepositoryId: "string",
    });
    
    type: azuredevops:Git
    properties:
        defaultBranch: string
        initialization:
            initType: string
            serviceConnectionId: string
            sourceType: string
            sourceUrl: string
        name: string
        parentRepositoryId: string
        projectId: string
    

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

    Initialization Pulumi.AzureDevOps.Inputs.GitInitialization
    An initialization block as documented below.
    ProjectId string
    The project ID or project name.
    DefaultBranch string
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    Name string
    The name of the git repository.
    ParentRepositoryId string
    The ID of a Git project from which a fork is to be created.
    Initialization GitInitializationArgs
    An initialization block as documented below.
    ProjectId string
    The project ID or project name.
    DefaultBranch string
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    Name string
    The name of the git repository.
    ParentRepositoryId string
    The ID of a Git project from which a fork is to be created.
    initialization GitInitialization
    An initialization block as documented below.
    projectId String
    The project ID or project name.
    defaultBranch String
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    name String
    The name of the git repository.
    parentRepositoryId String
    The ID of a Git project from which a fork is to be created.
    initialization GitInitialization
    An initialization block as documented below.
    projectId string
    The project ID or project name.
    defaultBranch string
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    name string
    The name of the git repository.
    parentRepositoryId string
    The ID of a Git project from which a fork is to be created.
    initialization GitInitializationArgs
    An initialization block as documented below.
    project_id str
    The project ID or project name.
    default_branch str
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    name str
    The name of the git repository.
    parent_repository_id str
    The ID of a Git project from which a fork is to be created.
    initialization Property Map
    An initialization block as documented below.
    projectId String
    The project ID or project name.
    defaultBranch String
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    name String
    The name of the git repository.
    parentRepositoryId String
    The ID of a Git project from which a fork is to be created.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    IsFork bool
    True if the repository was created as a fork.
    RemoteUrl string
    Git HTTPS URL of the repository
    Size int
    Size in bytes.
    SshUrl string
    Git SSH URL of the repository.
    Url string
    REST API URL of the repository.
    WebUrl string
    Web link to the repository.
    Id string
    The provider-assigned unique ID for this managed resource.
    IsFork bool
    True if the repository was created as a fork.
    RemoteUrl string
    Git HTTPS URL of the repository
    Size int
    Size in bytes.
    SshUrl string
    Git SSH URL of the repository.
    Url string
    REST API URL of the repository.
    WebUrl string
    Web link to the repository.
    id String
    The provider-assigned unique ID for this managed resource.
    isFork Boolean
    True if the repository was created as a fork.
    remoteUrl String
    Git HTTPS URL of the repository
    size Integer
    Size in bytes.
    sshUrl String
    Git SSH URL of the repository.
    url String
    REST API URL of the repository.
    webUrl String
    Web link to the repository.
    id string
    The provider-assigned unique ID for this managed resource.
    isFork boolean
    True if the repository was created as a fork.
    remoteUrl string
    Git HTTPS URL of the repository
    size number
    Size in bytes.
    sshUrl string
    Git SSH URL of the repository.
    url string
    REST API URL of the repository.
    webUrl string
    Web link to the repository.
    id str
    The provider-assigned unique ID for this managed resource.
    is_fork bool
    True if the repository was created as a fork.
    remote_url str
    Git HTTPS URL of the repository
    size int
    Size in bytes.
    ssh_url str
    Git SSH URL of the repository.
    url str
    REST API URL of the repository.
    web_url str
    Web link to the repository.
    id String
    The provider-assigned unique ID for this managed resource.
    isFork Boolean
    True if the repository was created as a fork.
    remoteUrl String
    Git HTTPS URL of the repository
    size Number
    Size in bytes.
    sshUrl String
    Git SSH URL of the repository.
    url String
    REST API URL of the repository.
    webUrl String
    Web link to the repository.

    Look up Existing Git Resource

    Get an existing Git 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?: GitState, opts?: CustomResourceOptions): Git
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            default_branch: Optional[str] = None,
            initialization: Optional[GitInitializationArgs] = None,
            is_fork: Optional[bool] = None,
            name: Optional[str] = None,
            parent_repository_id: Optional[str] = None,
            project_id: Optional[str] = None,
            remote_url: Optional[str] = None,
            size: Optional[int] = None,
            ssh_url: Optional[str] = None,
            url: Optional[str] = None,
            web_url: Optional[str] = None) -> Git
    func GetGit(ctx *Context, name string, id IDInput, state *GitState, opts ...ResourceOption) (*Git, error)
    public static Git Get(string name, Input<string> id, GitState? state, CustomResourceOptions? opts = null)
    public static Git get(String name, Output<String> id, GitState 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:
    DefaultBranch string
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    Initialization Pulumi.AzureDevOps.Inputs.GitInitialization
    An initialization block as documented below.
    IsFork bool
    True if the repository was created as a fork.
    Name string
    The name of the git repository.
    ParentRepositoryId string
    The ID of a Git project from which a fork is to be created.
    ProjectId string
    The project ID or project name.
    RemoteUrl string
    Git HTTPS URL of the repository
    Size int
    Size in bytes.
    SshUrl string
    Git SSH URL of the repository.
    Url string
    REST API URL of the repository.
    WebUrl string
    Web link to the repository.
    DefaultBranch string
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    Initialization GitInitializationArgs
    An initialization block as documented below.
    IsFork bool
    True if the repository was created as a fork.
    Name string
    The name of the git repository.
    ParentRepositoryId string
    The ID of a Git project from which a fork is to be created.
    ProjectId string
    The project ID or project name.
    RemoteUrl string
    Git HTTPS URL of the repository
    Size int
    Size in bytes.
    SshUrl string
    Git SSH URL of the repository.
    Url string
    REST API URL of the repository.
    WebUrl string
    Web link to the repository.
    defaultBranch String
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    initialization GitInitialization
    An initialization block as documented below.
    isFork Boolean
    True if the repository was created as a fork.
    name String
    The name of the git repository.
    parentRepositoryId String
    The ID of a Git project from which a fork is to be created.
    projectId String
    The project ID or project name.
    remoteUrl String
    Git HTTPS URL of the repository
    size Integer
    Size in bytes.
    sshUrl String
    Git SSH URL of the repository.
    url String
    REST API URL of the repository.
    webUrl String
    Web link to the repository.
    defaultBranch string
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    initialization GitInitialization
    An initialization block as documented below.
    isFork boolean
    True if the repository was created as a fork.
    name string
    The name of the git repository.
    parentRepositoryId string
    The ID of a Git project from which a fork is to be created.
    projectId string
    The project ID or project name.
    remoteUrl string
    Git HTTPS URL of the repository
    size number
    Size in bytes.
    sshUrl string
    Git SSH URL of the repository.
    url string
    REST API URL of the repository.
    webUrl string
    Web link to the repository.
    default_branch str
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    initialization GitInitializationArgs
    An initialization block as documented below.
    is_fork bool
    True if the repository was created as a fork.
    name str
    The name of the git repository.
    parent_repository_id str
    The ID of a Git project from which a fork is to be created.
    project_id str
    The project ID or project name.
    remote_url str
    Git HTTPS URL of the repository
    size int
    Size in bytes.
    ssh_url str
    Git SSH URL of the repository.
    url str
    REST API URL of the repository.
    web_url str
    Web link to the repository.
    defaultBranch String
    The ref of the default branch. Will be used as the branch name for initialized repositories.
    initialization Property Map
    An initialization block as documented below.
    isFork Boolean
    True if the repository was created as a fork.
    name String
    The name of the git repository.
    parentRepositoryId String
    The ID of a Git project from which a fork is to be created.
    projectId String
    The project ID or project name.
    remoteUrl String
    Git HTTPS URL of the repository
    size Number
    Size in bytes.
    sshUrl String
    Git SSH URL of the repository.
    url String
    REST API URL of the repository.
    webUrl String
    Web link to the repository.

    Supporting Types

    GitInitialization, GitInitializationArgs

    InitType string
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    ServiceConnectionId string
    The id of service connection used to authenticate to a private repository for import initialization.
    SourceType string
    Type of the source repository. Used if the init_type is Import. Valid values: Git.
    SourceUrl string
    The URL of the source repository. Used if the init_type is Import.
    InitType string
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    ServiceConnectionId string
    The id of service connection used to authenticate to a private repository for import initialization.
    SourceType string
    Type of the source repository. Used if the init_type is Import. Valid values: Git.
    SourceUrl string
    The URL of the source repository. Used if the init_type is Import.
    initType String
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    serviceConnectionId String
    The id of service connection used to authenticate to a private repository for import initialization.
    sourceType String
    Type of the source repository. Used if the init_type is Import. Valid values: Git.
    sourceUrl String
    The URL of the source repository. Used if the init_type is Import.
    initType string
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    serviceConnectionId string
    The id of service connection used to authenticate to a private repository for import initialization.
    sourceType string
    Type of the source repository. Used if the init_type is Import. Valid values: Git.
    sourceUrl string
    The URL of the source repository. Used if the init_type is Import.
    init_type str
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    service_connection_id str
    The id of service connection used to authenticate to a private repository for import initialization.
    source_type str
    Type of the source repository. Used if the init_type is Import. Valid values: Git.
    source_url str
    The URL of the source repository. Used if the init_type is Import.
    initType String
    The type of repository to create. Valid values: Uninitialized, Clean or Import.
    serviceConnectionId String
    The id of service connection used to authenticate to a private repository for import initialization.
    sourceType String
    Type of the source repository. Used if the init_type is Import. Valid values: Git.
    sourceUrl String
    The URL of the source repository. Used if the init_type is Import.

    Package Details

    Repository
    Azure DevOps pulumi/pulumi-azuredevops
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the azuredevops Terraform Provider.
    azuredevops logo
    Azure DevOps v3.0.0 published on Friday, Mar 15, 2024 by Pulumi