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

gitlab.ProjectCustomAttribute

Explore with Pulumi AI

The gitlab.ProjectCustomAttribute resource allows to manage custom attributes for a project.

Upstream API: GitLab REST API docs

Example Usage

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

const attr = new gitlab.ProjectCustomAttribute("attr", {
    project: 42,
    key: "location",
    value: "Greenland",
});
Copy
import pulumi
import pulumi_gitlab as gitlab

attr = gitlab.ProjectCustomAttribute("attr",
    project=42,
    key="location",
    value="Greenland")
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 {
		_, err := gitlab.NewProjectCustomAttribute(ctx, "attr", &gitlab.ProjectCustomAttributeArgs{
			Project: pulumi.Int(42),
			Key:     pulumi.String("location"),
			Value:   pulumi.String("Greenland"),
		})
		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(() => 
{
    var attr = new GitLab.ProjectCustomAttribute("attr", new()
    {
        Project = 42,
        Key = "location",
        Value = "Greenland",
    });

});
Copy
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.ProjectCustomAttribute;
import com.pulumi.gitlab.ProjectCustomAttributeArgs;
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 attr = new ProjectCustomAttribute("attr", ProjectCustomAttributeArgs.builder()
            .project("42")
            .key("location")
            .value("Greenland")
            .build());

    }
}
Copy
resources:
  attr:
    type: gitlab:ProjectCustomAttribute
    properties:
      project: '42'
      key: location
      value: Greenland
Copy

Create ProjectCustomAttribute Resource

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

Constructor syntax

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

@overload
def ProjectCustomAttribute(resource_name: str,
                           opts: Optional[ResourceOptions] = None,
                           key: Optional[str] = None,
                           project: Optional[int] = None,
                           value: Optional[str] = None)
func NewProjectCustomAttribute(ctx *Context, name string, args ProjectCustomAttributeArgs, opts ...ResourceOption) (*ProjectCustomAttribute, error)
public ProjectCustomAttribute(string name, ProjectCustomAttributeArgs args, CustomResourceOptions? opts = null)
public ProjectCustomAttribute(String name, ProjectCustomAttributeArgs args)
public ProjectCustomAttribute(String name, ProjectCustomAttributeArgs args, CustomResourceOptions options)
type: gitlab:ProjectCustomAttribute
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. ProjectCustomAttributeArgs
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. ProjectCustomAttributeArgs
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. ProjectCustomAttributeArgs
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. ProjectCustomAttributeArgs
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. ProjectCustomAttributeArgs
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 projectCustomAttributeResource = new GitLab.ProjectCustomAttribute("projectCustomAttributeResource", new()
{
    Key = "string",
    Project = 0,
    Value = "string",
});
Copy
example, err := gitlab.NewProjectCustomAttribute(ctx, "projectCustomAttributeResource", &gitlab.ProjectCustomAttributeArgs{
	Key:     pulumi.String("string"),
	Project: pulumi.Int(0),
	Value:   pulumi.String("string"),
})
Copy
var projectCustomAttributeResource = new ProjectCustomAttribute("projectCustomAttributeResource", ProjectCustomAttributeArgs.builder()
    .key("string")
    .project(0)
    .value("string")
    .build());
Copy
project_custom_attribute_resource = gitlab.ProjectCustomAttribute("projectCustomAttributeResource",
    key="string",
    project=0,
    value="string")
Copy
const projectCustomAttributeResource = new gitlab.ProjectCustomAttribute("projectCustomAttributeResource", {
    key: "string",
    project: 0,
    value: "string",
});
Copy
type: gitlab:ProjectCustomAttribute
properties:
    key: string
    project: 0
    value: string
Copy

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

Key This property is required. string
Key for the Custom Attribute.
Project This property is required. int
The id of the project.
Value This property is required. string
Value for the Custom Attribute.
Key This property is required. string
Key for the Custom Attribute.
Project This property is required. int
The id of the project.
Value This property is required. string
Value for the Custom Attribute.
key This property is required. String
Key for the Custom Attribute.
project This property is required. Integer
The id of the project.
value This property is required. String
Value for the Custom Attribute.
key This property is required. string
Key for the Custom Attribute.
project This property is required. number
The id of the project.
value This property is required. string
Value for the Custom Attribute.
key This property is required. str
Key for the Custom Attribute.
project This property is required. int
The id of the project.
value This property is required. str
Value for the Custom Attribute.
key This property is required. String
Key for the Custom Attribute.
project This property is required. Number
The id of the project.
value This property is required. String
Value for the Custom Attribute.

Outputs

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

Id string
The provider-assigned unique ID for this managed resource.
Id string
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.
id string
The provider-assigned unique ID for this managed resource.
id str
The provider-assigned unique ID for this managed resource.
id String
The provider-assigned unique ID for this managed resource.

Look up Existing ProjectCustomAttribute Resource

Get an existing ProjectCustomAttribute 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?: ProjectCustomAttributeState, opts?: CustomResourceOptions): ProjectCustomAttribute
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        key: Optional[str] = None,
        project: Optional[int] = None,
        value: Optional[str] = None) -> ProjectCustomAttribute
func GetProjectCustomAttribute(ctx *Context, name string, id IDInput, state *ProjectCustomAttributeState, opts ...ResourceOption) (*ProjectCustomAttribute, error)
public static ProjectCustomAttribute Get(string name, Input<string> id, ProjectCustomAttributeState? state, CustomResourceOptions? opts = null)
public static ProjectCustomAttribute get(String name, Output<String> id, ProjectCustomAttributeState state, CustomResourceOptions options)
resources:  _:    type: gitlab:ProjectCustomAttribute    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:
Key string
Key for the Custom Attribute.
Project int
The id of the project.
Value string
Value for the Custom Attribute.
Key string
Key for the Custom Attribute.
Project int
The id of the project.
Value string
Value for the Custom Attribute.
key String
Key for the Custom Attribute.
project Integer
The id of the project.
value String
Value for the Custom Attribute.
key string
Key for the Custom Attribute.
project number
The id of the project.
value string
Value for the Custom Attribute.
key str
Key for the Custom Attribute.
project int
The id of the project.
value str
Value for the Custom Attribute.
key String
Key for the Custom Attribute.
project Number
The id of the project.
value String
Value for the Custom Attribute.

Import

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

terraform

import {

to = gitlab_project_custom_attribute.example

id = “see CLI command below for ID”

}

Import using the CLI is supported using the following syntax:

You can import a project custom attribute using an id made up of {project-id}:{key}, e.g.

$ pulumi import gitlab:index/projectCustomAttribute:ProjectCustomAttribute attr 42:location
Copy

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.