1. Packages
  2. Gitlab Provider
  3. API Docs
  4. ProjectTag
GitLab v8.10.0 published on Friday, Mar 21, 2025 by Pulumi

gitlab.ProjectTag

Explore with Pulumi AI

The gitlab.ProjectTag resource allows to manage the lifecycle of a tag in a project.

Upstream API: GitLab API docs

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";

// Create a project for the tag to use
const example = new gitlab.Project("example", {
    name: "example",
    description: "An example project",
    namespaceId: exampleGitlabGroup.id,
});
const exampleProjectTag = new gitlab.ProjectTag("example", {
    name: "example",
    ref: "main",
    project: example.id,
});
Copy
import pulumi
import pulumi_gitlab as gitlab

# Create a project for the tag to use
example = gitlab.Project("example",
    name="example",
    description="An example project",
    namespace_id=example_gitlab_group["id"])
example_project_tag = gitlab.ProjectTag("example",
    name="example",
    ref="main",
    project=example.id)
Copy
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 {
		// Create a project for the tag to use
		example, err := gitlab.NewProject(ctx, "example", &gitlab.ProjectArgs{
			Name:        pulumi.String("example"),
			Description: pulumi.String("An example project"),
			NamespaceId: pulumi.Any(exampleGitlabGroup.Id),
		})
		if err != nil {
			return err
		}
		_, err = gitlab.NewProjectTag(ctx, "example", &gitlab.ProjectTagArgs{
			Name:    pulumi.String("example"),
			Ref:     pulumi.String("main"),
			Project: example.ID(),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
Copy
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;

return await Deployment.RunAsync(() => 
{
    // Create a project for the tag to use
    var example = new GitLab.Project("example", new()
    {
        Name = "example",
        Description = "An example project",
        NamespaceId = exampleGitlabGroup.Id,
    });

    var exampleProjectTag = new GitLab.ProjectTag("example", new()
    {
        Name = "example",
        Ref = "main",
        Project = example.Id,
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.Project;
import com.pulumi.gitlab.ProjectArgs;
import com.pulumi.gitlab.ProjectTag;
import com.pulumi.gitlab.ProjectTagArgs;
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) {
        // Create a project for the tag to use
        var example = new Project("example", ProjectArgs.builder()
            .name("example")
            .description("An example project")
            .namespaceId(exampleGitlabGroup.id())
            .build());

        var exampleProjectTag = new ProjectTag("exampleProjectTag", ProjectTagArgs.builder()
            .name("example")
            .ref("main")
            .project(example.id())
            .build());

    }
}
Copy
resources:
  # Create a project for the tag to use
  example:
    type: gitlab:Project
    properties:
      name: example
      description: An example project
      namespaceId: ${exampleGitlabGroup.id}
  exampleProjectTag:
    type: gitlab:ProjectTag
    name: example
    properties:
      name: example
      ref: main
      project: ${example.id}
Copy

Create ProjectTag Resource

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

Constructor syntax

new ProjectTag(name: string, args: ProjectTagArgs, opts?: CustomResourceOptions);
@overload
def ProjectTag(resource_name: str,
               args: ProjectTagArgs,
               opts: Optional[ResourceOptions] = None)

@overload
def ProjectTag(resource_name: str,
               opts: Optional[ResourceOptions] = None,
               project: Optional[str] = None,
               ref: Optional[str] = None,
               message: Optional[str] = None,
               name: Optional[str] = None)
func NewProjectTag(ctx *Context, name string, args ProjectTagArgs, opts ...ResourceOption) (*ProjectTag, error)
public ProjectTag(string name, ProjectTagArgs args, CustomResourceOptions? opts = null)
public ProjectTag(String name, ProjectTagArgs args)
public ProjectTag(String name, ProjectTagArgs args, CustomResourceOptions options)
type: gitlab:ProjectTag
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.

Parameters

name This property is required. string
The unique name of the resource.
args This property is required. ProjectTagArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
resource_name This property is required. str
The unique name of the resource.
args This property is required. ProjectTagArgs
The arguments to resource properties.
opts ResourceOptions
Bag of options to control resource's behavior.
ctx Context
Context object for the current deployment.
name This property is required. string
The unique name of the resource.
args This property is required. ProjectTagArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name This property is required. string
The unique name of the resource.
args This property is required. ProjectTagArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.
name This property is required. String
The unique name of the resource.
args This property is required. ProjectTagArgs
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 projectTagResource = new GitLab.ProjectTag("projectTagResource", new()
{
    Project = "string",
    Ref = "string",
    Message = "string",
    Name = "string",
});
Copy
example, err := gitlab.NewProjectTag(ctx, "projectTagResource", &gitlab.ProjectTagArgs{
	Project: pulumi.String("string"),
	Ref:     pulumi.String("string"),
	Message: pulumi.String("string"),
	Name:    pulumi.String("string"),
})
Copy
var projectTagResource = new ProjectTag("projectTagResource", ProjectTagArgs.builder()
    .project("string")
    .ref("string")
    .message("string")
    .name("string")
    .build());
Copy
project_tag_resource = gitlab.ProjectTag("projectTagResource",
    project="string",
    ref="string",
    message="string",
    name="string")
Copy
const projectTagResource = new gitlab.ProjectTag("projectTagResource", {
    project: "string",
    ref: "string",
    message: "string",
    name: "string",
});
Copy
type: gitlab:ProjectTag
properties:
    message: string
    name: string
    project: string
    ref: string
Copy

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

Project
This property is required.
Changes to this property will trigger replacement.
string
The ID or URL-encoded path of the project owned by the authenticated user.
Ref
This property is required.
Changes to this property will trigger replacement.
string
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
Message Changes to this property will trigger replacement. string
The message of the annotated tag.
Name Changes to this property will trigger replacement. string
The name of a tag.
Project
This property is required.
Changes to this property will trigger replacement.
string
The ID or URL-encoded path of the project owned by the authenticated user.
Ref
This property is required.
Changes to this property will trigger replacement.
string
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
Message Changes to this property will trigger replacement. string
The message of the annotated tag.
Name Changes to this property will trigger replacement. string
The name of a tag.
project
This property is required.
Changes to this property will trigger replacement.
String
The ID or URL-encoded path of the project owned by the authenticated user.
ref
This property is required.
Changes to this property will trigger replacement.
String
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
message Changes to this property will trigger replacement. String
The message of the annotated tag.
name Changes to this property will trigger replacement. String
The name of a tag.
project
This property is required.
Changes to this property will trigger replacement.
string
The ID or URL-encoded path of the project owned by the authenticated user.
ref
This property is required.
Changes to this property will trigger replacement.
string
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
message Changes to this property will trigger replacement. string
The message of the annotated tag.
name Changes to this property will trigger replacement. string
The name of a tag.
project
This property is required.
Changes to this property will trigger replacement.
str
The ID or URL-encoded path of the project owned by the authenticated user.
ref
This property is required.
Changes to this property will trigger replacement.
str
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
message Changes to this property will trigger replacement. str
The message of the annotated tag.
name Changes to this property will trigger replacement. str
The name of a tag.
project
This property is required.
Changes to this property will trigger replacement.
String
The ID or URL-encoded path of the project owned by the authenticated user.
ref
This property is required.
Changes to this property will trigger replacement.
String
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
message Changes to this property will trigger replacement. String
The message of the annotated tag.
name Changes to this property will trigger replacement. String
The name of a tag.

Outputs

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

Commits List<Pulumi.GitLab.Outputs.ProjectTagCommit>
The commit associated with the tag.
Id string
The provider-assigned unique ID for this managed resource.
Protected bool
Bool, true if tag has tag protection.
Releases List<Pulumi.GitLab.Outputs.ProjectTagRelease>
The release associated with the tag.
Target string
The unique id assigned to the commit by Gitlab.
Commits []ProjectTagCommit
The commit associated with the tag.
Id string
The provider-assigned unique ID for this managed resource.
Protected bool
Bool, true if tag has tag protection.
Releases []ProjectTagRelease
The release associated with the tag.
Target string
The unique id assigned to the commit by Gitlab.
commits List<ProjectTagCommit>
The commit associated with the tag.
id String
The provider-assigned unique ID for this managed resource.
protected_ Boolean
Bool, true if tag has tag protection.
releases List<ProjectTagRelease>
The release associated with the tag.
target String
The unique id assigned to the commit by Gitlab.
commits ProjectTagCommit[]
The commit associated with the tag.
id string
The provider-assigned unique ID for this managed resource.
protected boolean
Bool, true if tag has tag protection.
releases ProjectTagRelease[]
The release associated with the tag.
target string
The unique id assigned to the commit by Gitlab.
commits Sequence[ProjectTagCommit]
The commit associated with the tag.
id str
The provider-assigned unique ID for this managed resource.
protected bool
Bool, true if tag has tag protection.
releases Sequence[ProjectTagRelease]
The release associated with the tag.
target str
The unique id assigned to the commit by Gitlab.
commits List<Property Map>
The commit associated with the tag.
id String
The provider-assigned unique ID for this managed resource.
protected Boolean
Bool, true if tag has tag protection.
releases List<Property Map>
The release associated with the tag.
target String
The unique id assigned to the commit by Gitlab.

Look up Existing ProjectTag Resource

Get an existing ProjectTag 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?: ProjectTagState, opts?: CustomResourceOptions): ProjectTag
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        commits: Optional[Sequence[ProjectTagCommitArgs]] = None,
        message: Optional[str] = None,
        name: Optional[str] = None,
        project: Optional[str] = None,
        protected: Optional[bool] = None,
        ref: Optional[str] = None,
        releases: Optional[Sequence[ProjectTagReleaseArgs]] = None,
        target: Optional[str] = None) -> ProjectTag
func GetProjectTag(ctx *Context, name string, id IDInput, state *ProjectTagState, opts ...ResourceOption) (*ProjectTag, error)
public static ProjectTag Get(string name, Input<string> id, ProjectTagState? state, CustomResourceOptions? opts = null)
public static ProjectTag get(String name, Output<String> id, ProjectTagState state, CustomResourceOptions options)
resources:  _:    type: gitlab:ProjectTag    get:      id: ${id}
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
The unique provider ID of the resource to lookup.
name This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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 This property is required.
The unique name of the resulting resource.
id This property is required.
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:
Commits List<Pulumi.GitLab.Inputs.ProjectTagCommit>
The commit associated with the tag.
Message Changes to this property will trigger replacement. string
The message of the annotated tag.
Name Changes to this property will trigger replacement. string
The name of a tag.
Project Changes to this property will trigger replacement. string
The ID or URL-encoded path of the project owned by the authenticated user.
Protected bool
Bool, true if tag has tag protection.
Ref Changes to this property will trigger replacement. string
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
Releases List<Pulumi.GitLab.Inputs.ProjectTagRelease>
The release associated with the tag.
Target string
The unique id assigned to the commit by Gitlab.
Commits []ProjectTagCommitArgs
The commit associated with the tag.
Message Changes to this property will trigger replacement. string
The message of the annotated tag.
Name Changes to this property will trigger replacement. string
The name of a tag.
Project Changes to this property will trigger replacement. string
The ID or URL-encoded path of the project owned by the authenticated user.
Protected bool
Bool, true if tag has tag protection.
Ref Changes to this property will trigger replacement. string
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
Releases []ProjectTagReleaseArgs
The release associated with the tag.
Target string
The unique id assigned to the commit by Gitlab.
commits List<ProjectTagCommit>
The commit associated with the tag.
message Changes to this property will trigger replacement. String
The message of the annotated tag.
name Changes to this property will trigger replacement. String
The name of a tag.
project Changes to this property will trigger replacement. String
The ID or URL-encoded path of the project owned by the authenticated user.
protected_ Boolean
Bool, true if tag has tag protection.
ref Changes to this property will trigger replacement. String
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
releases List<ProjectTagRelease>
The release associated with the tag.
target String
The unique id assigned to the commit by Gitlab.
commits ProjectTagCommit[]
The commit associated with the tag.
message Changes to this property will trigger replacement. string
The message of the annotated tag.
name Changes to this property will trigger replacement. string
The name of a tag.
project Changes to this property will trigger replacement. string
The ID or URL-encoded path of the project owned by the authenticated user.
protected boolean
Bool, true if tag has tag protection.
ref Changes to this property will trigger replacement. string
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
releases ProjectTagRelease[]
The release associated with the tag.
target string
The unique id assigned to the commit by Gitlab.
commits Sequence[ProjectTagCommitArgs]
The commit associated with the tag.
message Changes to this property will trigger replacement. str
The message of the annotated tag.
name Changes to this property will trigger replacement. str
The name of a tag.
project Changes to this property will trigger replacement. str
The ID or URL-encoded path of the project owned by the authenticated user.
protected bool
Bool, true if tag has tag protection.
ref Changes to this property will trigger replacement. str
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
releases Sequence[ProjectTagReleaseArgs]
The release associated with the tag.
target str
The unique id assigned to the commit by Gitlab.
commits List<Property Map>
The commit associated with the tag.
message Changes to this property will trigger replacement. String
The message of the annotated tag.
name Changes to this property will trigger replacement. String
The name of a tag.
project Changes to this property will trigger replacement. String
The ID or URL-encoded path of the project owned by the authenticated user.
protected Boolean
Bool, true if tag has tag protection.
ref Changes to this property will trigger replacement. String
Create tag using commit SHA, another tag name, or branch name. This attribute is not available for imported resources.
releases List<Property Map>
The release associated with the tag.
target String
The unique id assigned to the commit by Gitlab.

Supporting Types

ProjectTagCommit
, ProjectTagCommitArgs

AuthorEmail string
The email of the author.
AuthorName string
The name of the author.
AuthoredDate string
The date which the commit was authored (format: yyyy-MM-ddTHH:mm:ssZ).
CommittedDate string
The date at which the commit was pushed (format: yyyy-MM-ddTHH:mm:ssZ).
CommitterEmail string
The email of the user that committed.
CommitterName string
The name of the user that committed.
Id string
The unique id assigned to the commit by Gitlab.
Message string
The commit message
ParentIds List<string>
The id of the parents of the commit
ShortId string
The short id assigned to the commit by Gitlab.
Title string
The title of the commit
AuthorEmail string
The email of the author.
AuthorName string
The name of the author.
AuthoredDate string
The date which the commit was authored (format: yyyy-MM-ddTHH:mm:ssZ).
CommittedDate string
The date at which the commit was pushed (format: yyyy-MM-ddTHH:mm:ssZ).
CommitterEmail string
The email of the user that committed.
CommitterName string
The name of the user that committed.
Id string
The unique id assigned to the commit by Gitlab.
Message string
The commit message
ParentIds []string
The id of the parents of the commit
ShortId string
The short id assigned to the commit by Gitlab.
Title string
The title of the commit
authorEmail String
The email of the author.
authorName String
The name of the author.
authoredDate String
The date which the commit was authored (format: yyyy-MM-ddTHH:mm:ssZ).
committedDate String
The date at which the commit was pushed (format: yyyy-MM-ddTHH:mm:ssZ).
committerEmail String
The email of the user that committed.
committerName String
The name of the user that committed.
id String
The unique id assigned to the commit by Gitlab.
message String
The commit message
parentIds List<String>
The id of the parents of the commit
shortId String
The short id assigned to the commit by Gitlab.
title String
The title of the commit
authorEmail string
The email of the author.
authorName string
The name of the author.
authoredDate string
The date which the commit was authored (format: yyyy-MM-ddTHH:mm:ssZ).
committedDate string
The date at which the commit was pushed (format: yyyy-MM-ddTHH:mm:ssZ).
committerEmail string
The email of the user that committed.
committerName string
The name of the user that committed.
id string
The unique id assigned to the commit by Gitlab.
message string
The commit message
parentIds string[]
The id of the parents of the commit
shortId string
The short id assigned to the commit by Gitlab.
title string
The title of the commit
author_email str
The email of the author.
author_name str
The name of the author.
authored_date str
The date which the commit was authored (format: yyyy-MM-ddTHH:mm:ssZ).
committed_date str
The date at which the commit was pushed (format: yyyy-MM-ddTHH:mm:ssZ).
committer_email str
The email of the user that committed.
committer_name str
The name of the user that committed.
id str
The unique id assigned to the commit by Gitlab.
message str
The commit message
parent_ids Sequence[str]
The id of the parents of the commit
short_id str
The short id assigned to the commit by Gitlab.
title str
The title of the commit
authorEmail String
The email of the author.
authorName String
The name of the author.
authoredDate String
The date which the commit was authored (format: yyyy-MM-ddTHH:mm:ssZ).
committedDate String
The date at which the commit was pushed (format: yyyy-MM-ddTHH:mm:ssZ).
committerEmail String
The email of the user that committed.
committerName String
The name of the user that committed.
id String
The unique id assigned to the commit by Gitlab.
message String
The commit message
parentIds List<String>
The id of the parents of the commit
shortId String
The short id assigned to the commit by Gitlab.
title String
The title of the commit

ProjectTagRelease
, ProjectTagReleaseArgs

Description string
The description of release.
TagName string
The name of the tag.
Description string
The description of release.
TagName string
The name of the tag.
description String
The description of release.
tagName String
The name of the tag.
description string
The description of release.
tagName string
The name of the tag.
description str
The description of release.
tag_name str
The name of the tag.
description String
The description of release.
tagName String
The name of the tag.

Import

Starting in Terraform v1.5.0 you can use an import block to import gitlab_project_tag. For example:

terraform

import {

to = gitlab_project_tag.example

id = “see CLI command below for ID”

}

Import using the CLI is supported using the following syntax:

Gitlab project tags can be imported with a key composed of <project_id>:<tag_name>, e.g.

$ pulumi import gitlab:index/projectTag:ProjectTag example "12345:develop"
Copy

NOTE: the ref attribute won’t be available for imported gitlab_project_tag resources.

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.