1. Packages
  2. Gitlab Provider
  3. API Docs
  4. ProjectMirror
GitLab v8.4.1 published on Tuesday, Sep 24, 2024 by Pulumi

gitlab.ProjectMirror

Explore with Pulumi AI

gitlab logo
GitLab v8.4.1 published on Tuesday, Sep 24, 2024 by Pulumi

    The gitlab.ProjectMirror resource allows to manage the lifecycle of a project mirror.

    This is for pushing changes to a remote repository. Pull Mirroring can be configured using a combination of the import_url, mirror, and mirror_trigger_builds properties on the gitlab.Project resource.

    Warning By default, the provider sets the keep_divergent_refs argument to True. If you manually set keep_divergent_refs to False, GitLab mirroring removes branches in the target that aren’t in the source. This action can result in unexpected branch deletions.

    Destroy Behavior GitLab 14.10 introduced an API endpoint to delete a project mirror. Therefore, for GitLab 14.10 and newer the project mirror will be destroyed when the resource is destroyed. For older versions, the mirror will be disabled and the resource will be destroyed.

    Upstream API: GitLab REST API docs

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gitlab from "@pulumi/gitlab";
    
    const foo = new gitlab.ProjectMirror("foo", {
        project: "1",
        url: "https://username:password@github.com/org/repository.git",
    });
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    foo = gitlab.ProjectMirror("foo",
        project="1",
        url="https://username:password@github.com/org/repository.git")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-gitlab/sdk/v8/go/gitlab"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := gitlab.NewProjectMirror(ctx, "foo", &gitlab.ProjectMirrorArgs{
    			Project: pulumi.String("1"),
    			Url:     pulumi.String("https://username:password@github.com/org/repository.git"),
    		})
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using GitLab = Pulumi.GitLab;
    
    return await Deployment.RunAsync(() => 
    {
        var foo = new GitLab.ProjectMirror("foo", new()
        {
            Project = "1",
            Url = "https://username:password@github.com/org/repository.git",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.gitlab.ProjectMirror;
    import com.pulumi.gitlab.ProjectMirrorArgs;
    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 foo = new ProjectMirror("foo", ProjectMirrorArgs.builder()
                .project("1")
                .url("https://username:password@github.com/org/repository.git")
                .build());
    
        }
    }
    
    resources:
      foo:
        type: gitlab:ProjectMirror
        properties:
          project: '1'
          url: https://username:password@github.com/org/repository.git
    

    Create ProjectMirror Resource

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

    Constructor syntax

    new ProjectMirror(name: string, args: ProjectMirrorArgs, opts?: CustomResourceOptions);
    @overload
    def ProjectMirror(resource_name: str,
                      args: ProjectMirrorArgs,
                      opts: Optional[ResourceOptions] = None)
    
    @overload
    def ProjectMirror(resource_name: str,
                      opts: Optional[ResourceOptions] = None,
                      project: Optional[str] = None,
                      url: Optional[str] = None,
                      enabled: Optional[bool] = None,
                      keep_divergent_refs: Optional[bool] = None,
                      only_protected_branches: Optional[bool] = None)
    func NewProjectMirror(ctx *Context, name string, args ProjectMirrorArgs, opts ...ResourceOption) (*ProjectMirror, error)
    public ProjectMirror(string name, ProjectMirrorArgs args, CustomResourceOptions? opts = null)
    public ProjectMirror(String name, ProjectMirrorArgs args)
    public ProjectMirror(String name, ProjectMirrorArgs args, CustomResourceOptions options)
    
    type: gitlab:ProjectMirror
    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 ProjectMirrorArgs
    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 ProjectMirrorArgs
    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 ProjectMirrorArgs
    The arguments to resource properties.
    opts ResourceOption
    Bag of options to control resource's behavior.
    name string
    The unique name of the resource.
    args ProjectMirrorArgs
    The arguments to resource properties.
    opts CustomResourceOptions
    Bag of options to control resource's behavior.
    name String
    The unique name of the resource.
    args ProjectMirrorArgs
    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 projectMirrorResource = new GitLab.ProjectMirror("projectMirrorResource", new()
    {
        Project = "string",
        Url = "string",
        Enabled = false,
        KeepDivergentRefs = false,
        OnlyProtectedBranches = false,
    });
    
    example, err := gitlab.NewProjectMirror(ctx, "projectMirrorResource", &gitlab.ProjectMirrorArgs{
    	Project:               pulumi.String("string"),
    	Url:                   pulumi.String("string"),
    	Enabled:               pulumi.Bool(false),
    	KeepDivergentRefs:     pulumi.Bool(false),
    	OnlyProtectedBranches: pulumi.Bool(false),
    })
    
    var projectMirrorResource = new ProjectMirror("projectMirrorResource", ProjectMirrorArgs.builder()
        .project("string")
        .url("string")
        .enabled(false)
        .keepDivergentRefs(false)
        .onlyProtectedBranches(false)
        .build());
    
    project_mirror_resource = gitlab.ProjectMirror("projectMirrorResource",
        project="string",
        url="string",
        enabled=False,
        keep_divergent_refs=False,
        only_protected_branches=False)
    
    const projectMirrorResource = new gitlab.ProjectMirror("projectMirrorResource", {
        project: "string",
        url: "string",
        enabled: false,
        keepDivergentRefs: false,
        onlyProtectedBranches: false,
    });
    
    type: gitlab:ProjectMirror
    properties:
        enabled: false
        keepDivergentRefs: false
        onlyProtectedBranches: false
        project: string
        url: string
    

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

    Project string
    The id of the project.
    Url string
    The URL of the remote repository to be mirrored.
    Enabled bool
    Determines if the mirror is enabled.
    KeepDivergentRefs bool
    Determines if divergent refs are skipped.
    OnlyProtectedBranches bool
    Determines if only protected branches are mirrored.
    Project string
    The id of the project.
    Url string
    The URL of the remote repository to be mirrored.
    Enabled bool
    Determines if the mirror is enabled.
    KeepDivergentRefs bool
    Determines if divergent refs are skipped.
    OnlyProtectedBranches bool
    Determines if only protected branches are mirrored.
    project String
    The id of the project.
    url String
    The URL of the remote repository to be mirrored.
    enabled Boolean
    Determines if the mirror is enabled.
    keepDivergentRefs Boolean
    Determines if divergent refs are skipped.
    onlyProtectedBranches Boolean
    Determines if only protected branches are mirrored.
    project string
    The id of the project.
    url string
    The URL of the remote repository to be mirrored.
    enabled boolean
    Determines if the mirror is enabled.
    keepDivergentRefs boolean
    Determines if divergent refs are skipped.
    onlyProtectedBranches boolean
    Determines if only protected branches are mirrored.
    project str
    The id of the project.
    url str
    The URL of the remote repository to be mirrored.
    enabled bool
    Determines if the mirror is enabled.
    keep_divergent_refs bool
    Determines if divergent refs are skipped.
    only_protected_branches bool
    Determines if only protected branches are mirrored.
    project String
    The id of the project.
    url String
    The URL of the remote repository to be mirrored.
    enabled Boolean
    Determines if the mirror is enabled.
    keepDivergentRefs Boolean
    Determines if divergent refs are skipped.
    onlyProtectedBranches Boolean
    Determines if only protected branches are mirrored.

    Outputs

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

    Id string
    The provider-assigned unique ID for this managed resource.
    MirrorId int
    Mirror ID.
    Id string
    The provider-assigned unique ID for this managed resource.
    MirrorId int
    Mirror ID.
    id String
    The provider-assigned unique ID for this managed resource.
    mirrorId Integer
    Mirror ID.
    id string
    The provider-assigned unique ID for this managed resource.
    mirrorId number
    Mirror ID.
    id str
    The provider-assigned unique ID for this managed resource.
    mirror_id int
    Mirror ID.
    id String
    The provider-assigned unique ID for this managed resource.
    mirrorId Number
    Mirror ID.

    Look up Existing ProjectMirror Resource

    Get an existing ProjectMirror 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?: ProjectMirrorState, opts?: CustomResourceOptions): ProjectMirror
    @staticmethod
    def get(resource_name: str,
            id: str,
            opts: Optional[ResourceOptions] = None,
            enabled: Optional[bool] = None,
            keep_divergent_refs: Optional[bool] = None,
            mirror_id: Optional[int] = None,
            only_protected_branches: Optional[bool] = None,
            project: Optional[str] = None,
            url: Optional[str] = None) -> ProjectMirror
    func GetProjectMirror(ctx *Context, name string, id IDInput, state *ProjectMirrorState, opts ...ResourceOption) (*ProjectMirror, error)
    public static ProjectMirror Get(string name, Input<string> id, ProjectMirrorState? state, CustomResourceOptions? opts = null)
    public static ProjectMirror get(String name, Output<String> id, ProjectMirrorState 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:
    Enabled bool
    Determines if the mirror is enabled.
    KeepDivergentRefs bool
    Determines if divergent refs are skipped.
    MirrorId int
    Mirror ID.
    OnlyProtectedBranches bool
    Determines if only protected branches are mirrored.
    Project string
    The id of the project.
    Url string
    The URL of the remote repository to be mirrored.
    Enabled bool
    Determines if the mirror is enabled.
    KeepDivergentRefs bool
    Determines if divergent refs are skipped.
    MirrorId int
    Mirror ID.
    OnlyProtectedBranches bool
    Determines if only protected branches are mirrored.
    Project string
    The id of the project.
    Url string
    The URL of the remote repository to be mirrored.
    enabled Boolean
    Determines if the mirror is enabled.
    keepDivergentRefs Boolean
    Determines if divergent refs are skipped.
    mirrorId Integer
    Mirror ID.
    onlyProtectedBranches Boolean
    Determines if only protected branches are mirrored.
    project String
    The id of the project.
    url String
    The URL of the remote repository to be mirrored.
    enabled boolean
    Determines if the mirror is enabled.
    keepDivergentRefs boolean
    Determines if divergent refs are skipped.
    mirrorId number
    Mirror ID.
    onlyProtectedBranches boolean
    Determines if only protected branches are mirrored.
    project string
    The id of the project.
    url string
    The URL of the remote repository to be mirrored.
    enabled bool
    Determines if the mirror is enabled.
    keep_divergent_refs bool
    Determines if divergent refs are skipped.
    mirror_id int
    Mirror ID.
    only_protected_branches bool
    Determines if only protected branches are mirrored.
    project str
    The id of the project.
    url str
    The URL of the remote repository to be mirrored.
    enabled Boolean
    Determines if the mirror is enabled.
    keepDivergentRefs Boolean
    Determines if divergent refs are skipped.
    mirrorId Number
    Mirror ID.
    onlyProtectedBranches Boolean
    Determines if only protected branches are mirrored.
    project String
    The id of the project.
    url String
    The URL of the remote repository to be mirrored.

    Import

    GitLab project mirror can be imported using an id made up of project_id:mirror_id, e.g.

    $ pulumi import gitlab:index/projectMirror:ProjectMirror foo "12345:1337"
    

    To learn more about importing existing cloud resources, see Importing resources.

    Package Details

    Repository
    GitLab pulumi/pulumi-gitlab
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the gitlab Terraform Provider.
    gitlab logo
    GitLab v8.4.1 published on Tuesday, Sep 24, 2024 by Pulumi