gitlab logo
GitLab v4.9.0, Oct 24 22

gitlab.getGroupVariable

The gitlab.GroupVariable data source allows to retrieve details about a group-level CI/CD variable.

Upstream API: GitLab REST API docs

Example Usage

using System.Collections.Generic;
using Pulumi;
using GitLab = Pulumi.GitLab;

return await Deployment.RunAsync(() => 
{
    var foo = GitLab.GetGroupVariable.Invoke(new()
    {
        Group = "my/example/group",
        Key = "foo",
    });

    var bar = GitLab.GetGroupVariable.Invoke(new()
    {
        EnvironmentScope = "staging/*",
        Group = "my/example/group",
        Key = "bar",
    });

});
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.LookupGroupVariable(ctx, &GetGroupVariableArgs{
			Group: "my/example/group",
			Key:   "foo",
		}, nil)
		if err != nil {
			return err
		}
		_, err = gitlab.LookupGroupVariable(ctx, &GetGroupVariableArgs{
			EnvironmentScope: pulumi.StringRef("staging/*"),
			Group:            "my/example/group",
			Key:              "bar",
		}, nil)
		if err != nil {
			return err
		}
		return nil
	})
}
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetGroupVariableArgs;
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) {
        final var foo = GitlabFunctions.getGroupVariable(GetGroupVariableArgs.builder()
            .group("my/example/group")
            .key("foo")
            .build());

        final var bar = GitlabFunctions.getGroupVariable(GetGroupVariableArgs.builder()
            .environmentScope("staging/*")
            .group("my/example/group")
            .key("bar")
            .build());

    }
}
import pulumi
import pulumi_gitlab as gitlab

foo = gitlab.get_group_variable(group="my/example/group",
    key="foo")
bar = gitlab.get_group_variable(environment_scope="staging/*",
    group="my/example/group",
    key="bar")
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";

const foo = pulumi.output(gitlab.getGroupVariable({
    group: "my/example/group",
    key: "foo",
}));
// Using an environment scope
const bar = pulumi.output(gitlab.getGroupVariable({
    environmentScope: "staging/*",
    group: "my/example/group",
    key: "bar",
}));
variables:
  foo:
    fn::invoke:
      Function: gitlab:getGroupVariable
      Arguments:
        group: my/example/group
        key: foo
  bar:
    fn::invoke:
      Function: gitlab:getGroupVariable
      Arguments:
        environmentScope: staging/*
        group: my/example/group
        key: bar

Using getGroupVariable

Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

function getGroupVariable(args: GetGroupVariableArgs, opts?: InvokeOptions): Promise<GetGroupVariableResult>
function getGroupVariableOutput(args: GetGroupVariableOutputArgs, opts?: InvokeOptions): Output<GetGroupVariableResult>
def get_group_variable(environment_scope: Optional[str] = None,
                       group: Optional[str] = None,
                       key: Optional[str] = None,
                       opts: Optional[InvokeOptions] = None) -> GetGroupVariableResult
def get_group_variable_output(environment_scope: Optional[pulumi.Input[str]] = None,
                       group: Optional[pulumi.Input[str]] = None,
                       key: Optional[pulumi.Input[str]] = None,
                       opts: Optional[InvokeOptions] = None) -> Output[GetGroupVariableResult]
func LookupGroupVariable(ctx *Context, args *LookupGroupVariableArgs, opts ...InvokeOption) (*LookupGroupVariableResult, error)
func LookupGroupVariableOutput(ctx *Context, args *LookupGroupVariableOutputArgs, opts ...InvokeOption) LookupGroupVariableResultOutput

> Note: This function is named LookupGroupVariable in the Go SDK.

public static class GetGroupVariable 
{
    public static Task<GetGroupVariableResult> InvokeAsync(GetGroupVariableArgs args, InvokeOptions? opts = null)
    public static Output<GetGroupVariableResult> Invoke(GetGroupVariableInvokeArgs args, InvokeOptions? opts = null)
}
public static CompletableFuture<GetGroupVariableResult> getGroupVariable(GetGroupVariableArgs args, InvokeOptions options)
// Output-based functions aren't available in Java yet
fn::invoke:
  function: gitlab:index/getGroupVariable:getGroupVariable
  arguments:
    # arguments dictionary

The following arguments are supported:

Group string

The name or id of the group.

Key string

The name of the variable.

EnvironmentScope string

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

Group string

The name or id of the group.

Key string

The name of the variable.

EnvironmentScope string

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

group String

The name or id of the group.

key String

The name of the variable.

environmentScope String

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

group string

The name or id of the group.

key string

The name of the variable.

environmentScope string

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

group str

The name or id of the group.

key str

The name of the variable.

environment_scope str

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

group String

The name or id of the group.

key String

The name of the variable.

environmentScope String

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

getGroupVariable Result

The following output properties are available:

EnvironmentScope string

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

Group string

The name or id of the group.

Id string

The provider-assigned unique ID for this managed resource.

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. Valid values are: env_var, file. Default is env_var.

EnvironmentScope string

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

Group string

The name or id of the group.

Id string

The provider-assigned unique ID for this managed resource.

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. Valid values are: env_var, file. Default is env_var.

environmentScope String

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

group String

The name or id of the group.

id String

The provider-assigned unique ID for this managed resource.

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. Valid values are: env_var, file. Default is env_var.

environmentScope string

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

group string

The name or id of the group.

id string

The provider-assigned unique ID for this managed resource.

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. Valid values are: env_var, file. Default is env_var.

environment_scope str

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

group str

The name or id of the group.

id str

The provider-assigned unique ID for this managed resource.

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. Valid values are: env_var, file. Default is env_var.

environmentScope String

The environment scope of the variable. Defaults to all environment (*). Note that in Community Editions of Gitlab, values other than * will cause inconsistent plans.

group String

The name or id of the group.

id String

The provider-assigned unique ID for this managed resource.

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. Valid values are: env_var, file. Default is env_var.

Package Details

Repository
GitLab pulumi/pulumi-gitlab
License
Apache-2.0
Notes

This Pulumi package is based on the gitlab Terraform Provider.