InstanceVariable

This resource allows you to create and manage CI/CD variables for your GitLab instance. For further information on variables, consult the gitlab documentation.

Example Usage

using Pulumi;
using GitLab = Pulumi.GitLab;

class MyStack : Stack
{
    public MyStack()
    {
        var example = new GitLab.InstanceVariable("example", new GitLab.InstanceVariableArgs
        {
            Key = "instance_variable_key",
            Masked = false,
            Protected = false,
            Value = "instance_variable_value",
        });
    }

}
package main

import (
	"github.com/pulumi/pulumi-gitlab/sdk/v4/go/gitlab"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := gitlab.NewInstanceVariable(ctx, "example", &gitlab.InstanceVariableArgs{
			Key:       pulumi.String("instance_variable_key"),
			Masked:    pulumi.Bool(false),
			Protected: pulumi.Bool(false),
			Value:     pulumi.String("instance_variable_value"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
import pulumi
import pulumi_gitlab as gitlab

example = gitlab.InstanceVariable("example",
    key="instance_variable_key",
    masked=False,
    protected=False,
    value="instance_variable_value")
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";

const example = new gitlab.InstanceVariable("example", {
    key: "instance_variable_key",
    masked: false,
    protected: false,
    value: "instance_variable_value",
});

Create a InstanceVariable Resource

new InstanceVariable(name: string, args: InstanceVariableArgs, opts?: CustomResourceOptions);
@overload
def InstanceVariable(resource_name: str,
                     opts: Optional[ResourceOptions] = None,
                     key: Optional[str] = None,
                     masked: Optional[bool] = None,
                     protected: Optional[bool] = None,
                     value: Optional[str] = None,
                     variable_type: Optional[str] = None)
@overload
def InstanceVariable(resource_name: str,
                     args: InstanceVariableArgs,
                     opts: Optional[ResourceOptions] = None)
func NewInstanceVariable(ctx *Context, name string, args InstanceVariableArgs, opts ...ResourceOption) (*InstanceVariable, error)
public InstanceVariable(string name, InstanceVariableArgs args, CustomResourceOptions? opts = null)
name string
The unique name of the resource.
args InstanceVariableArgs
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 InstanceVariableArgs
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 InstanceVariableArgs
The arguments to resource properties.
opts ResourceOption
Bag of options to control resource's behavior.
name string
The unique name of the resource.
args InstanceVariableArgs
The arguments to resource properties.
opts CustomResourceOptions
Bag of options to control resource's behavior.

InstanceVariable Resource Properties

To learn more about resource properties and how to use them, see Inputs and Outputs in the Programming Model docs.

Inputs

The InstanceVariable resource accepts the following input properties:

Key string
The name of the variable.
Value string
The value of the variable.
Masked bool
If set to true, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false.
Protected bool
If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
VariableType string
The type of a variable. Available types are: env_var (default) and file.
Key string
The name of the variable.
Value string
The value of the variable.
Masked bool
If set to true, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false.
Protected bool
If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
VariableType string
The type of a variable. Available types are: env_var (default) and file.
key string
The name of the variable.
value string
The value of the variable.
masked boolean
If set to true, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false.
protected boolean
If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
variableType string
The type of a variable. Available types are: env_var (default) and file.
key str
The name of the variable.
value str
The value of the variable.
masked bool
If set to true, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false.
protected bool
If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
variable_type str
The type of a variable. Available types are: env_var (default) and file.

Outputs

All input properties are implicitly available as output properties. Additionally, the InstanceVariable 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 str
The provider-assigned unique ID for this managed resource.

Look up an Existing InstanceVariable Resource

Get an existing InstanceVariable 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?: InstanceVariableState, opts?: CustomResourceOptions): InstanceVariable
@staticmethod
def get(resource_name: str,
        id: str,
        opts: Optional[ResourceOptions] = None,
        key: Optional[str] = None,
        masked: Optional[bool] = None,
        protected: Optional[bool] = None,
        value: Optional[str] = None,
        variable_type: Optional[str] = None) -> InstanceVariable
func GetInstanceVariable(ctx *Context, name string, id IDInput, state *InstanceVariableState, opts ...ResourceOption) (*InstanceVariable, error)
public static InstanceVariable Get(string name, Input<string> id, InstanceVariableState? state, CustomResourceOptions? opts = null)
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.

The following state arguments are supported:

Key string
The name of the variable.
Masked bool
If set to true, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false.
Protected bool
If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
Value string
The value of the variable.
VariableType string
The type of a variable. Available types are: env_var (default) and file.
Key string
The name of the variable.
Masked bool
If set to true, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false.
Protected bool
If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
Value string
The value of the variable.
VariableType string
The type of a variable. Available types are: env_var (default) and file.
key string
The name of the variable.
masked boolean
If set to true, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false.
protected boolean
If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
value string
The value of the variable.
variableType string
The type of a variable. Available types are: env_var (default) and file.
key str
The name of the variable.
masked bool
If set to true, the value of the variable will be hidden in job logs. The value must meet the masking requirements. Defaults to false.
protected bool
If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
value str
The value of the variable.
variable_type str
The type of a variable. Available types are: env_var (default) and file.

Import

GitLab instance variables can be imported using an id made up of variablename, e.g. console

 $ pulumi import gitlab:index/instanceVariable:InstanceVariable example instance_variable_key

Package Details

Repository
https://github.com/pulumi/pulumi-gitlab
License
Apache-2.0
Notes
This Pulumi package is based on the gitlab Terraform Provider.