getProjectVariable

The gitlab.ProjectVariable data source allows to retrieve details about a project-level CI/CD variable. Upstream API: GitLab REST API docs

Example Usage

import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const foo = gitlab.getProjectVariable({
project: "my/example/project",
key: "foo",
});
// Using an environment scope
const bar = gitlab.getProjectVariable({
project: "my/example/project",
key: "bar",
environmentScope: "staging/*",
});
import pulumi
import pulumi_gitlab as gitlab
foo = gitlab.get_project_variable(project="my/example/project",
key="foo")
# Using an environment scope
bar = gitlab.get_project_variable(project="my/example/project",
key="bar",
environment_scope="staging/*")
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var foo = GitLab.GetProjectVariable.Invoke(new()
{
Project = "my/example/project",
Key = "foo",
});
// Using an environment scope
var bar = GitLab.GetProjectVariable.Invoke(new()
{
Project = "my/example/project",
Key = "bar",
EnvironmentScope = "staging/*",
});
});
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.LookupProjectVariable(ctx, &gitlab.LookupProjectVariableArgs{
Project: "my/example/project",
Key: "foo",
}, nil)
if err != nil {
return err
}
// Using an environment scope
_, err = gitlab.LookupProjectVariable(ctx, &gitlab.LookupProjectVariableArgs{
Project: "my/example/project",
Key: "bar",
EnvironmentScope: pulumi.StringRef("staging/*"),
}, 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.GetProjectVariableArgs;
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.getProjectVariable(GetProjectVariableArgs.builder()
.project("my/example/project")
.key("foo")
.build());
// Using an environment scope
final var bar = GitlabFunctions.getProjectVariable(GetProjectVariableArgs.builder()
.project("my/example/project")
.key("bar")
.environmentScope("staging/*")
.build());
}
}
variables:
foo:
fn::invoke:
function: gitlab:getProjectVariable
arguments:
project: my/example/project
key: foo
# Using an environment scope
bar:
fn::invoke:
function: gitlab:getProjectVariable
arguments:
project: my/example/project
key: bar
environmentScope: staging/*

Return

A collection of values returned by getProjectVariable. //////

Parameters

argument

A collection of arguments for invoking getProjectVariable.


suspend fun getProjectVariable(environmentScope: String? = null, key: String, project: String): GetProjectVariableResult

Return

A collection of values returned by getProjectVariable.

Parameters

environmentScope

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

key

The name of the variable.

project

The name or id of the project.

See also


Return

A collection of values returned by getProjectVariable.

Parameters

argument

Builder for com.pulumi.gitlab.kotlin.inputs.GetProjectVariablePlainArgs.

See also