1. Packages
  2. GitLab
  3. API Docs
  4. getProjectVariables
GitLab v6.11.0 published on Friday, Apr 19, 2024 by Pulumi

gitlab.getProjectVariables

Explore with Pulumi AI

gitlab logo
GitLab v6.11.0 published on Friday, Apr 19, 2024 by Pulumi

    The gitlab.getProjectVariables data source allows to retrieve all project-level CI/CD variables.

    Upstream API: GitLab REST API docs

    Example Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as gitlab from "@pulumi/gitlab";
    
    const vars = gitlab.getProjectVariables({
        project: "my/example/project",
    });
    const stagingVars = gitlab.getProjectVariables({
        environmentScope: "staging/*",
        project: "my/example/project",
    });
    
    import pulumi
    import pulumi_gitlab as gitlab
    
    vars = gitlab.get_project_variables(project="my/example/project")
    staging_vars = gitlab.get_project_variables(environment_scope="staging/*",
        project="my/example/project")
    
    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.GetProjectVariables(ctx, &gitlab.GetProjectVariablesArgs{
    			Project: "my/example/project",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		_, err = gitlab.GetProjectVariables(ctx, &gitlab.GetProjectVariablesArgs{
    			EnvironmentScope: pulumi.StringRef("staging/*"),
    			Project:          "my/example/project",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using GitLab = Pulumi.GitLab;
    
    return await Deployment.RunAsync(() => 
    {
        var vars = GitLab.GetProjectVariables.Invoke(new()
        {
            Project = "my/example/project",
        });
    
        var stagingVars = GitLab.GetProjectVariables.Invoke(new()
        {
            EnvironmentScope = "staging/*",
            Project = "my/example/project",
        });
    
    });
    
    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.GetProjectVariablesArgs;
    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 vars = GitlabFunctions.getProjectVariables(GetProjectVariablesArgs.builder()
                .project("my/example/project")
                .build());
    
            final var stagingVars = GitlabFunctions.getProjectVariables(GetProjectVariablesArgs.builder()
                .environmentScope("staging/*")
                .project("my/example/project")
                .build());
    
        }
    }
    
    variables:
      vars:
        fn::invoke:
          Function: gitlab:getProjectVariables
          Arguments:
            project: my/example/project
      stagingVars:
        fn::invoke:
          Function: gitlab:getProjectVariables
          Arguments:
            environmentScope: staging/*
            project: my/example/project
    

    Using getProjectVariables

    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 getProjectVariables(args: GetProjectVariablesArgs, opts?: InvokeOptions): Promise<GetProjectVariablesResult>
    function getProjectVariablesOutput(args: GetProjectVariablesOutputArgs, opts?: InvokeOptions): Output<GetProjectVariablesResult>
    def get_project_variables(environment_scope: Optional[str] = None,
                              project: Optional[str] = None,
                              opts: Optional[InvokeOptions] = None) -> GetProjectVariablesResult
    def get_project_variables_output(environment_scope: Optional[pulumi.Input[str]] = None,
                              project: Optional[pulumi.Input[str]] = None,
                              opts: Optional[InvokeOptions] = None) -> Output[GetProjectVariablesResult]
    func GetProjectVariables(ctx *Context, args *GetProjectVariablesArgs, opts ...InvokeOption) (*GetProjectVariablesResult, error)
    func GetProjectVariablesOutput(ctx *Context, args *GetProjectVariablesOutputArgs, opts ...InvokeOption) GetProjectVariablesResultOutput

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

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

    The following arguments are supported:

    getProjectVariables Result

    The following output properties are available:

    Id string
    The provider-assigned unique ID for this managed resource.
    Project string
    The name or id of the project.
    Variables List<Pulumi.GitLab.Outputs.GetProjectVariablesVariable>
    The list of variables returned by the search
    EnvironmentScope string
    The environment scope of the variable. Defaults to all environment (*).
    Id string
    The provider-assigned unique ID for this managed resource.
    Project string
    The name or id of the project.
    Variables []GetProjectVariablesVariable
    The list of variables returned by the search
    EnvironmentScope string
    The environment scope of the variable. Defaults to all environment (*).
    id String
    The provider-assigned unique ID for this managed resource.
    project String
    The name or id of the project.
    variables List<GetProjectVariablesVariable>
    The list of variables returned by the search
    environmentScope String
    The environment scope of the variable. Defaults to all environment (*).
    id string
    The provider-assigned unique ID for this managed resource.
    project string
    The name or id of the project.
    variables GetProjectVariablesVariable[]
    The list of variables returned by the search
    environmentScope string
    The environment scope of the variable. Defaults to all environment (*).
    id str
    The provider-assigned unique ID for this managed resource.
    project str
    The name or id of the project.
    variables Sequence[GetProjectVariablesVariable]
    The list of variables returned by the search
    environment_scope str
    The environment scope of the variable. Defaults to all environment (*).
    id String
    The provider-assigned unique ID for this managed resource.
    project String
    The name or id of the project.
    variables List<Property Map>
    The list of variables returned by the search
    environmentScope String
    The environment scope of the variable. Defaults to all environment (*).

    Supporting Types

    GetProjectVariablesVariable

    Description string
    The description 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.
    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.
    Project string
    The name or id of the project.
    Protected bool
    If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
    Raw bool
    Whether the variable is treated as a raw string. Default: false. When true, variables in the value are not expanded.
    Value string
    The value of the variable.
    VariableType string
    The type of a variable. Valid values are: env_var, file. Default is env_var.
    Description string
    The description 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.
    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.
    Project string
    The name or id of the project.
    Protected bool
    If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
    Raw bool
    Whether the variable is treated as a raw string. Default: false. When true, variables in the value are not expanded.
    Value string
    The value of the variable.
    VariableType string
    The type of a variable. Valid values are: env_var, file. Default is env_var.
    description String
    The description 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.
    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.
    project String
    The name or id of the project.
    protected_ Boolean
    If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
    raw Boolean
    Whether the variable is treated as a raw string. Default: false. When true, variables in the value are not expanded.
    value String
    The value of the variable.
    variableType String
    The type of a variable. Valid values are: env_var, file. Default is env_var.
    description string
    The description 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.
    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.
    project string
    The name or id of the project.
    protected boolean
    If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
    raw boolean
    Whether the variable is treated as a raw string. Default: false. When true, variables in the value are not expanded.
    value string
    The value of the variable.
    variableType string
    The type of a variable. Valid values are: env_var, file. Default is env_var.
    description str
    The description 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.
    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.
    project str
    The name or id of the project.
    protected bool
    If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
    raw bool
    Whether the variable is treated as a raw string. Default: false. When true, variables in the value are not expanded.
    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.
    description String
    The description 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.
    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.
    project String
    The name or id of the project.
    protected Boolean
    If set to true, the variable will be passed only to pipelines running on protected branches and tags. Defaults to false.
    raw Boolean
    Whether the variable is treated as a raw string. Default: false. When true, variables in the value are not expanded.
    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.
    gitlab logo
    GitLab v6.11.0 published on Friday, Apr 19, 2024 by Pulumi