The gitlab.ProjectPushMirror resource manages the lifecycle of a project mirror.
This is for pushing changes to a remote repository. Pull Mirroring can be configured with the gitlab.ProjectPullMirror resource.
Warning By default, the provider sets the
keep_divergent_refsargument toTrue. If you manually setkeep_divergent_refstoFalse, GitLab mirroring removes branches in the target that aren’t in the source. This action can result in unexpected branch deletions.
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const foo = new gitlab.ProjectPushMirror("foo", {
project: "1",
url: "https://username:password@github.com/org/repository.git",
});
import pulumi
import pulumi_gitlab as gitlab
foo = gitlab.ProjectPushMirror("foo",
project="1",
url="https://username:password@github.com/org/repository.git")
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v9/go/gitlab"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
_, err := gitlab.NewProjectPushMirror(ctx, "foo", &gitlab.ProjectPushMirrorArgs{
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.ProjectPushMirror("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.ProjectPushMirror;
import com.pulumi.gitlab.ProjectPushMirrorArgs;
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 ProjectPushMirror("foo", ProjectPushMirrorArgs.builder()
.project("1")
.url("https://username:password@github.com/org/repository.git")
.build());
}
}
resources:
foo:
type: gitlab:ProjectPushMirror
properties:
project: '1'
url: https://username:password@github.com/org/repository.git
Create ProjectPushMirror Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new ProjectPushMirror(name: string, args: ProjectPushMirrorArgs, opts?: CustomResourceOptions);@overload
def ProjectPushMirror(resource_name: str,
args: ProjectPushMirrorArgs,
opts: Optional[ResourceOptions] = None)
@overload
def ProjectPushMirror(resource_name: str,
opts: Optional[ResourceOptions] = None,
project: Optional[str] = None,
url: Optional[str] = None,
auth_method: Optional[str] = None,
enabled: Optional[bool] = None,
keep_divergent_refs: Optional[bool] = None,
mirror_branch_regex: Optional[str] = None,
only_protected_branches: Optional[bool] = None)func NewProjectPushMirror(ctx *Context, name string, args ProjectPushMirrorArgs, opts ...ResourceOption) (*ProjectPushMirror, error)public ProjectPushMirror(string name, ProjectPushMirrorArgs args, CustomResourceOptions? opts = null)
public ProjectPushMirror(String name, ProjectPushMirrorArgs args)
public ProjectPushMirror(String name, ProjectPushMirrorArgs args, CustomResourceOptions options)
type: gitlab:ProjectPushMirror
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 ProjectPushMirrorArgs
- 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 ProjectPushMirrorArgs
- 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 ProjectPushMirrorArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args ProjectPushMirrorArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args ProjectPushMirrorArgs
- 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 projectPushMirrorResource = new GitLab.ProjectPushMirror("projectPushMirrorResource", new()
{
Project = "string",
Url = "string",
AuthMethod = "string",
Enabled = false,
KeepDivergentRefs = false,
MirrorBranchRegex = "string",
OnlyProtectedBranches = false,
});
example, err := gitlab.NewProjectPushMirror(ctx, "projectPushMirrorResource", &gitlab.ProjectPushMirrorArgs{
Project: pulumi.String("string"),
Url: pulumi.String("string"),
AuthMethod: pulumi.String("string"),
Enabled: pulumi.Bool(false),
KeepDivergentRefs: pulumi.Bool(false),
MirrorBranchRegex: pulumi.String("string"),
OnlyProtectedBranches: pulumi.Bool(false),
})
var projectPushMirrorResource = new ProjectPushMirror("projectPushMirrorResource", ProjectPushMirrorArgs.builder()
.project("string")
.url("string")
.authMethod("string")
.enabled(false)
.keepDivergentRefs(false)
.mirrorBranchRegex("string")
.onlyProtectedBranches(false)
.build());
project_push_mirror_resource = gitlab.ProjectPushMirror("projectPushMirrorResource",
project="string",
url="string",
auth_method="string",
enabled=False,
keep_divergent_refs=False,
mirror_branch_regex="string",
only_protected_branches=False)
const projectPushMirrorResource = new gitlab.ProjectPushMirror("projectPushMirrorResource", {
project: "string",
url: "string",
authMethod: "string",
enabled: false,
keepDivergentRefs: false,
mirrorBranchRegex: "string",
onlyProtectedBranches: false,
});
type: gitlab:ProjectPushMirror
properties:
authMethod: string
enabled: false
keepDivergentRefs: false
mirrorBranchRegex: string
onlyProtectedBranches: false
project: string
url: string
ProjectPushMirror 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 ProjectPushMirror resource accepts the following input properties:
- Project string
- The id of the project.
- Url string
- The URL of the remote repository to be mirrored.
- Auth
Method string - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - Enabled bool
- Determines if the mirror is enabled.
- Keep
Divergent boolRefs - Determines if divergent refs are skipped.
- Mirror
Branch stringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- Auth
Method string - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - Enabled bool
- Determines if the mirror is enabled.
- Keep
Divergent boolRefs - Determines if divergent refs are skipped.
- Mirror
Branch stringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- auth
Method String - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - enabled Boolean
- Determines if the mirror is enabled.
- keep
Divergent BooleanRefs - Determines if divergent refs are skipped.
- mirror
Branch StringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- auth
Method string - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - enabled boolean
- Determines if the mirror is enabled.
- keep
Divergent booleanRefs - Determines if divergent refs are skipped.
- mirror
Branch stringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- auth_
method str - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - enabled bool
- Determines if the mirror is enabled.
- keep_
divergent_ boolrefs - Determines if divergent refs are skipped.
- mirror_
branch_ strregex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- auth
Method String - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - enabled Boolean
- Determines if the mirror is enabled.
- keep
Divergent BooleanRefs - Determines if divergent refs are skipped.
- mirror
Branch StringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- only
Protected BooleanBranches - Determines if only protected branches are mirrored.
Outputs
All input properties are implicitly available as output properties. Additionally, the ProjectPushMirror resource produces the following output properties:
Look up Existing ProjectPushMirror Resource
Get an existing ProjectPushMirror 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?: ProjectPushMirrorState, opts?: CustomResourceOptions): ProjectPushMirror@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
auth_method: Optional[str] = None,
enabled: Optional[bool] = None,
keep_divergent_refs: Optional[bool] = None,
mirror_branch_regex: Optional[str] = None,
mirror_id: Optional[int] = None,
only_protected_branches: Optional[bool] = None,
project: Optional[str] = None,
url: Optional[str] = None) -> ProjectPushMirrorfunc GetProjectPushMirror(ctx *Context, name string, id IDInput, state *ProjectPushMirrorState, opts ...ResourceOption) (*ProjectPushMirror, error)public static ProjectPushMirror Get(string name, Input<string> id, ProjectPushMirrorState? state, CustomResourceOptions? opts = null)public static ProjectPushMirror get(String name, Output<String> id, ProjectPushMirrorState state, CustomResourceOptions options)resources: _: type: gitlab:ProjectPushMirror get: id: ${id}- 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.
- Auth
Method string - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - Enabled bool
- Determines if the mirror is enabled.
- Keep
Divergent boolRefs - Determines if divergent refs are skipped.
- Mirror
Branch stringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- Auth
Method string - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - Enabled bool
- Determines if the mirror is enabled.
- Keep
Divergent boolRefs - Determines if divergent refs are skipped.
- Mirror
Branch stringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- auth
Method String - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - enabled Boolean
- Determines if the mirror is enabled.
- keep
Divergent BooleanRefs - Determines if divergent refs are skipped.
- mirror
Branch StringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- auth
Method string - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - enabled boolean
- Determines if the mirror is enabled.
- keep
Divergent booleanRefs - Determines if divergent refs are skipped.
- mirror
Branch stringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- auth_
method str - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - enabled bool
- Determines if the mirror is enabled.
- keep_
divergent_ boolrefs - Determines if divergent refs are skipped.
- mirror_
branch_ strregex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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.
- auth
Method String - Determines the mirror authentication method. Valid values are:
ssh_public_key,password. - enabled Boolean
- Determines if the mirror is enabled.
- keep
Divergent BooleanRefs - Determines if divergent refs are skipped.
- mirror
Branch StringRegex - Contains a regular expression. Only branches with names matching the regex are mirrored. Requires onlyprotectedbranches to be disabled. Premium and Ultimate only.
- 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
Starting in Terraform v1.5.0, you can use an import block to import gitlab_project_push_mirror. For example:
terraform
import {
to = gitlab_project_push_mirror.example
id = “see CLI command below for ID”
}
Importing using the CLI is supported with the following syntax:
GitLab project mirror can be imported using an id made up of project_id:mirror_id, e.g.
$ pulumi import gitlab:index/projectPushMirror:ProjectPushMirror 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
gitlabTerraform Provider.
