gitlab.ProjectMirror
Explore with Pulumi AI
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 toTrue
. If you manually setkeep_divergent_refs
toFalse
, 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
In Python, inputs that are objects can be passed either as argument classes or as dictionary literals.
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.
- Keep
Divergent boolRefs - Determines if divergent refs are skipped.
- Only
Protected boolBranches - 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 boolRefs - Determines if divergent refs are skipped.
- Only
Protected boolBranches - 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.
- keep
Divergent BooleanRefs - Determines if divergent refs are skipped.
- only
Protected BooleanBranches - 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.
- keep
Divergent booleanRefs - Determines if divergent refs are skipped.
- only
Protected booleanBranches - 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_ boolrefs - Determines if divergent refs are skipped.
- only_
protected_ boolbranches - 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.
- keep
Divergent BooleanRefs - Determines if divergent refs are skipped.
- only
Protected BooleanBranches - 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:
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.
- Enabled bool
- Determines if the mirror is enabled.
- Keep
Divergent boolRefs - Determines if divergent refs are skipped.
- Mirror
Id int - Mirror ID.
- Only
Protected boolBranches - 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 boolRefs - Determines if divergent refs are skipped.
- Mirror
Id int - Mirror ID.
- Only
Protected boolBranches - 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.
- keep
Divergent BooleanRefs - Determines if divergent refs are skipped.
- mirror
Id Integer - Mirror ID.
- only
Protected BooleanBranches - 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.
- keep
Divergent booleanRefs - Determines if divergent refs are skipped.
- mirror
Id number - Mirror ID.
- only
Protected booleanBranches - 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_ boolrefs - Determines if divergent refs are skipped.
- mirror_
id int - Mirror ID.
- only_
protected_ boolbranches - 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.
- keep
Divergent BooleanRefs - Determines if divergent refs are skipped.
- mirror
Id Number - Mirror ID.
- only
Protected BooleanBranches - 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.