GitLab v8.11.0 published on Friday, Apr 18, 2025 by Pulumi
gitlab.getProjectEnvironments
Explore with Pulumi AI
The gitlab.getProjectEnvironments data source retrieves information about all environments of the given project.
Upstream API: GitLab REST API docs
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as gitlab from "@pulumi/gitlab";
const thisProject = new gitlab.Project("this", {
    name: "example",
    initializeWithReadme: true,
});
const _this = gitlab.getProjectEnvironmentsOutput({
    project: thisProject.pathWithNamespace,
});
import pulumi
import pulumi_gitlab as gitlab
this_project = gitlab.Project("this",
    name="example",
    initialize_with_readme=True)
this = gitlab.get_project_environments_output(project=this_project.path_with_namespace)
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 {
		thisProject, err := gitlab.NewProject(ctx, "this", &gitlab.ProjectArgs{
			Name:                 pulumi.String("example"),
			InitializeWithReadme: pulumi.Bool(true),
		})
		if err != nil {
			return err
		}
		_ = gitlab.GetProjectEnvironmentsOutput(ctx, gitlab.GetProjectEnvironmentsOutputArgs{
			Project: thisProject.PathWithNamespace,
		}, nil)
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using GitLab = Pulumi.GitLab;
return await Deployment.RunAsync(() => 
{
    var thisProject = new GitLab.Project("this", new()
    {
        Name = "example",
        InitializeWithReadme = true,
    });
    var @this = GitLab.GetProjectEnvironments.Invoke(new()
    {
        Project = thisProject.PathWithNamespace,
    });
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.gitlab.Project;
import com.pulumi.gitlab.ProjectArgs;
import com.pulumi.gitlab.GitlabFunctions;
import com.pulumi.gitlab.inputs.GetProjectEnvironmentsArgs;
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) {
        var thisProject = new Project("thisProject", ProjectArgs.builder()
            .name("example")
            .initializeWithReadme(true)
            .build());
        final var this = GitlabFunctions.getProjectEnvironments(GetProjectEnvironmentsArgs.builder()
            .project(thisProject.pathWithNamespace())
            .build());
    }
}
resources:
  thisProject:
    type: gitlab:Project
    name: this
    properties:
      name: example
      initializeWithReadme: true
variables:
  this:
    fn::invoke:
      function: gitlab:getProjectEnvironments
      arguments:
        project: ${thisProject.pathWithNamespace}
Using getProjectEnvironments
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 getProjectEnvironments(args: GetProjectEnvironmentsArgs, opts?: InvokeOptions): Promise<GetProjectEnvironmentsResult>
function getProjectEnvironmentsOutput(args: GetProjectEnvironmentsOutputArgs, opts?: InvokeOptions): Output<GetProjectEnvironmentsResult>def get_project_environments(name: Optional[str] = None,
                             project: Optional[str] = None,
                             search: Optional[str] = None,
                             states: Optional[str] = None,
                             opts: Optional[InvokeOptions] = None) -> GetProjectEnvironmentsResult
def get_project_environments_output(name: Optional[pulumi.Input[str]] = None,
                             project: Optional[pulumi.Input[str]] = None,
                             search: Optional[pulumi.Input[str]] = None,
                             states: Optional[pulumi.Input[str]] = None,
                             opts: Optional[InvokeOptions] = None) -> Output[GetProjectEnvironmentsResult]func GetProjectEnvironments(ctx *Context, args *GetProjectEnvironmentsArgs, opts ...InvokeOption) (*GetProjectEnvironmentsResult, error)
func GetProjectEnvironmentsOutput(ctx *Context, args *GetProjectEnvironmentsOutputArgs, opts ...InvokeOption) GetProjectEnvironmentsResultOutput> Note: This function is named GetProjectEnvironments in the Go SDK.
public static class GetProjectEnvironments 
{
    public static Task<GetProjectEnvironmentsResult> InvokeAsync(GetProjectEnvironmentsArgs args, InvokeOptions? opts = null)
    public static Output<GetProjectEnvironmentsResult> Invoke(GetProjectEnvironmentsInvokeArgs args, InvokeOptions? opts = null)
}public static CompletableFuture<GetProjectEnvironmentsResult> getProjectEnvironments(GetProjectEnvironmentsArgs args, InvokeOptions options)
public static Output<GetProjectEnvironmentsResult> getProjectEnvironments(GetProjectEnvironmentsArgs args, InvokeOptions options)
fn::invoke:
  function: gitlab:index/getProjectEnvironments:getProjectEnvironments
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Project string
 - The ID or full path of the project.
 - Name string
 - Return the environment with this name. Mutually exclusive with search.
 - Search string
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - States string
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- Project string
 - The ID or full path of the project.
 - Name string
 - Return the environment with this name. Mutually exclusive with search.
 - Search string
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - States string
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- project String
 - The ID or full path of the project.
 - name String
 - Return the environment with this name. Mutually exclusive with search.
 - search String
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - states String
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- project string
 - The ID or full path of the project.
 - name string
 - Return the environment with this name. Mutually exclusive with search.
 - search string
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - states string
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- project str
 - The ID or full path of the project.
 - name str
 - Return the environment with this name. Mutually exclusive with search.
 - search str
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - states str
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- project String
 - The ID or full path of the project.
 - name String
 - Return the environment with this name. Mutually exclusive with search.
 - search String
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - states String
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
getProjectEnvironments Result
The following output properties are available:
- Environments
List<Pulumi.
Git Lab. Outputs. Get Project Environments Environment>  - The list of environments.
 - Id string
 - Project string
 - The ID or full path of the project.
 - Name string
 - Return the environment with this name. Mutually exclusive with search.
 - Search string
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - States string
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- Environments
[]Get
Project Environments Environment  - The list of environments.
 - Id string
 - Project string
 - The ID or full path of the project.
 - Name string
 - Return the environment with this name. Mutually exclusive with search.
 - Search string
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - States string
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- environments
List<Get
Project Environments Environment>  - The list of environments.
 - id String
 - project String
 - The ID or full path of the project.
 - name String
 - Return the environment with this name. Mutually exclusive with search.
 - search String
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - states String
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- environments
Get
Project Environments Environment[]  - The list of environments.
 - id string
 - project string
 - The ID or full path of the project.
 - name string
 - Return the environment with this name. Mutually exclusive with search.
 - search string
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - states string
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- environments
Sequence[Get
Project Environments Environment]  - The list of environments.
 - id str
 - project str
 - The ID or full path of the project.
 - name str
 - Return the environment with this name. Mutually exclusive with search.
 - search str
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - states str
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
- environments List<Property Map>
 - The list of environments.
 - id String
 - project String
 - The ID or full path of the project.
 - name String
 - Return the environment with this name. Mutually exclusive with search.
 - search String
 - Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long.
 - states String
 - List all environments that match the specified state. Valid values are 
available,stopping,stopped. Returns all environments if not set. 
Supporting Types
GetProjectEnvironmentsEnvironment   
- Auto
Stop stringAt  - Timestamp of when the environment is scheduled to stop, RFC3339 format.
 - Auto
Stop stringSetting  - The auto stop setting for the environment.
 - Cluster
Agent intId  - The ID of the environments cluster agent or 
nullif none is assigned. - Created
At string - Timestamp of the environment creation, RFC3339 format.
 - Description string
 - The description of the environment.
 - External
Url string - Place to link to for this environment.
 - Flux
Resource stringPath  - The Flux resource path to associate with this environment.
 - Id int
 - The ID of the environment.
 - Kubernetes
Namespace string - The Kubernetes namespace to associate with this environment.
 - Name string
 - The name of the environment.
 - Slug string
 - The simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on. The slug is truncated to 24 characters. A random suffix is automatically added to uppercase environment names.
 - State string
 - The state of the environment. Value can be one of 
available,stopping,stopped. Returns all environments if not set. - Tier string
 - The tier of the environment. Value can be one of 
production,staging,testing,development,other. Returns all environments if not set. - Updated
At string - Timestamp of the last environment update, RFC3339 format.
 
- Auto
Stop stringAt  - Timestamp of when the environment is scheduled to stop, RFC3339 format.
 - Auto
Stop stringSetting  - The auto stop setting for the environment.
 - Cluster
Agent intId  - The ID of the environments cluster agent or 
nullif none is assigned. - Created
At string - Timestamp of the environment creation, RFC3339 format.
 - Description string
 - The description of the environment.
 - External
Url string - Place to link to for this environment.
 - Flux
Resource stringPath  - The Flux resource path to associate with this environment.
 - Id int
 - The ID of the environment.
 - Kubernetes
Namespace string - The Kubernetes namespace to associate with this environment.
 - Name string
 - The name of the environment.
 - Slug string
 - The simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on. The slug is truncated to 24 characters. A random suffix is automatically added to uppercase environment names.
 - State string
 - The state of the environment. Value can be one of 
available,stopping,stopped. Returns all environments if not set. - Tier string
 - The tier of the environment. Value can be one of 
production,staging,testing,development,other. Returns all environments if not set. - Updated
At string - Timestamp of the last environment update, RFC3339 format.
 
- auto
Stop StringAt  - Timestamp of when the environment is scheduled to stop, RFC3339 format.
 - auto
Stop StringSetting  - The auto stop setting for the environment.
 - cluster
Agent IntegerId  - The ID of the environments cluster agent or 
nullif none is assigned. - created
At String - Timestamp of the environment creation, RFC3339 format.
 - description String
 - The description of the environment.
 - external
Url String - Place to link to for this environment.
 - flux
Resource StringPath  - The Flux resource path to associate with this environment.
 - id Integer
 - The ID of the environment.
 - kubernetes
Namespace String - The Kubernetes namespace to associate with this environment.
 - name String
 - The name of the environment.
 - slug String
 - The simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on. The slug is truncated to 24 characters. A random suffix is automatically added to uppercase environment names.
 - state String
 - The state of the environment. Value can be one of 
available,stopping,stopped. Returns all environments if not set. - tier String
 - The tier of the environment. Value can be one of 
production,staging,testing,development,other. Returns all environments if not set. - updated
At String - Timestamp of the last environment update, RFC3339 format.
 
- auto
Stop stringAt  - Timestamp of when the environment is scheduled to stop, RFC3339 format.
 - auto
Stop stringSetting  - The auto stop setting for the environment.
 - cluster
Agent numberId  - The ID of the environments cluster agent or 
nullif none is assigned. - created
At string - Timestamp of the environment creation, RFC3339 format.
 - description string
 - The description of the environment.
 - external
Url string - Place to link to for this environment.
 - flux
Resource stringPath  - The Flux resource path to associate with this environment.
 - id number
 - The ID of the environment.
 - kubernetes
Namespace string - The Kubernetes namespace to associate with this environment.
 - name string
 - The name of the environment.
 - slug string
 - The simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on. The slug is truncated to 24 characters. A random suffix is automatically added to uppercase environment names.
 - state string
 - The state of the environment. Value can be one of 
available,stopping,stopped. Returns all environments if not set. - tier string
 - The tier of the environment. Value can be one of 
production,staging,testing,development,other. Returns all environments if not set. - updated
At string - Timestamp of the last environment update, RFC3339 format.
 
- auto_
stop_ strat  - Timestamp of when the environment is scheduled to stop, RFC3339 format.
 - auto_
stop_ strsetting  - The auto stop setting for the environment.
 - cluster_
agent_ intid  - The ID of the environments cluster agent or 
nullif none is assigned. - created_
at str - Timestamp of the environment creation, RFC3339 format.
 - description str
 - The description of the environment.
 - external_
url str - Place to link to for this environment.
 - flux_
resource_ strpath  - The Flux resource path to associate with this environment.
 - id int
 - The ID of the environment.
 - kubernetes_
namespace str - The Kubernetes namespace to associate with this environment.
 - name str
 - The name of the environment.
 - slug str
 - The simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on. The slug is truncated to 24 characters. A random suffix is automatically added to uppercase environment names.
 - state str
 - The state of the environment. Value can be one of 
available,stopping,stopped. Returns all environments if not set. - tier str
 - The tier of the environment. Value can be one of 
production,staging,testing,development,other. Returns all environments if not set. - updated_
at str - Timestamp of the last environment update, RFC3339 format.
 
- auto
Stop StringAt  - Timestamp of when the environment is scheduled to stop, RFC3339 format.
 - auto
Stop StringSetting  - The auto stop setting for the environment.
 - cluster
Agent NumberId  - The ID of the environments cluster agent or 
nullif none is assigned. - created
At String - Timestamp of the environment creation, RFC3339 format.
 - description String
 - The description of the environment.
 - external
Url String - Place to link to for this environment.
 - flux
Resource StringPath  - The Flux resource path to associate with this environment.
 - id Number
 - The ID of the environment.
 - kubernetes
Namespace String - The Kubernetes namespace to associate with this environment.
 - name String
 - The name of the environment.
 - slug String
 - The simplified version of the environment name, suitable for inclusion in DNS, URLs, Kubernetes labels, and so on. The slug is truncated to 24 characters. A random suffix is automatically added to uppercase environment names.
 - state String
 - The state of the environment. Value can be one of 
available,stopping,stopped. Returns all environments if not set. - tier String
 - The tier of the environment. Value can be one of 
production,staging,testing,development,other. Returns all environments if not set. - updated
At String - Timestamp of the last environment update, RFC3339 format.
 
Package Details
- Repository
 - GitLab pulumi/pulumi-gitlab
 - License
 - Apache-2.0
 - Notes
 - This Pulumi package is based on the 
gitlabTerraform Provider.