get Project Variable
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({
key: "foo",
project: "my/example/project",
});
const bar = gitlab.getProjectVariable({
environmentScope: "staging/*",
key: "bar",
project: "my/example/project",
});
Content copied to clipboard
import pulumi
import pulumi_gitlab as gitlab
foo = gitlab.get_project_variable(key="foo",
project="my/example/project")
bar = gitlab.get_project_variable(environment_scope="staging/*",
key="bar",
project="my/example/project")
Content copied to clipboard
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() =>
{
var foo = GitLab.GetProjectVariable.Invoke(new()
{
Key = "foo",
Project = "my/example/project",
});
var bar = GitLab.GetProjectVariable.Invoke(new()
{
EnvironmentScope = "staging/*",
Key = "bar",
Project = "my/example/project",
});
});
Content copied to clipboard
package main
import (
"github.com/pulumi/pulumi-gitlab/sdk/v6/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{
Key: "foo",
Project: "my/example/project",
}, nil)
if err != nil {
return err
}
_, err = gitlab.LookupProjectVariable(ctx, &gitlab.LookupProjectVariableArgs{
EnvironmentScope: pulumi.StringRef("staging/*"),
Key: "bar",
Project: "my/example/project",
}, nil)
if err != nil {
return err
}
return nil
})
}
Content copied to clipboard
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()
.key("foo")
.project("my/example/project")
.build());
final var bar = GitlabFunctions.getProjectVariable(GetProjectVariableArgs.builder()
.environmentScope("staging/*")
.key("bar")
.project("my/example/project")
.build());
}
}
Content copied to clipboard
variables:
foo:
fn::invoke:
Function: gitlab:getProjectVariable
Arguments:
key: foo
project: my/example/project
bar:
fn::invoke:
Function: gitlab:getProjectVariable
Arguments:
environmentScope: staging/*
key: bar
project: my/example/project
Content copied to clipboard
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
environment Scope
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
suspend fun getProjectVariable(argument: suspend GetProjectVariablePlainArgsBuilder.() -> Unit): GetProjectVariableResult
Return
A collection of values returned by getProjectVariable.
Parameters
argument
Builder for com.pulumi.gitlab.kotlin.inputs.GetProjectVariablePlainArgs.