|
| 1 | +--- |
| 2 | +# generated by https://github.com/hashicorp/terraform-plugin-docs |
| 3 | +page_title: "gitlab_project_environments Data Source - terraform-provider-gitlab" |
| 4 | +subcategory: "" |
| 5 | +description: |- |
| 6 | + The gitlab_project_environments data source retrieves information about all environments of the given project. |
| 7 | + Upstream API: GitLab REST API docs https://docs.gitlab.com/ee/api/environments.html#list-environments |
| 8 | +--- |
| 9 | + |
| 10 | +# gitlab_project_environments (Data Source) |
| 11 | + |
| 12 | +The `gitlab_project_environments` data source retrieves information about all environments of the given project. |
| 13 | + |
| 14 | +**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/ee/api/environments.html#list-environments) |
| 15 | + |
| 16 | +## Example Usage |
| 17 | + |
| 18 | +```terraform |
| 19 | +resource "gitlab_project" "this" { |
| 20 | + name = "example" |
| 21 | + initialize_with_readme = true |
| 22 | +} |
| 23 | +
|
| 24 | +data "gitlab_project_environments" "this" { |
| 25 | + project = gitlab_project.this.path_with_namespace # Can also use project id |
| 26 | +} |
| 27 | +``` |
| 28 | + |
| 29 | +<!-- schema generated by tfplugindocs --> |
| 30 | +## Schema |
| 31 | + |
| 32 | +### Required |
| 33 | + |
| 34 | +- `project` (String) The ID or full path of the project. |
| 35 | + |
| 36 | +### Optional |
| 37 | + |
| 38 | +- `name` (String) Return the environment with this name. Mutually exclusive with search. |
| 39 | +- `search` (String) Return list of environments matching the search criteria. Mutually exclusive with name. Must be at least 3 characters long. |
| 40 | +- `states` (String) List all environments that match the specified state. Valid values are `available`, `stopping`, `stopped`. Returns all environments if not set. |
| 41 | + |
| 42 | +### Read-Only |
| 43 | + |
| 44 | +- `environments` (Attributes List) The list of environments. (see [below for nested schema](#nestedatt--environments)) |
| 45 | +- `id` (String) The ID of this Terraform resource. |
| 46 | + |
| 47 | +<a id="nestedatt--environments"></a> |
| 48 | +### Nested Schema for `environments` |
| 49 | + |
| 50 | +Read-Only: |
| 51 | + |
| 52 | +- `cluster_agent_id` (Number) The ID of the environments cluster agent or `null` if none is assigned. |
| 53 | +- `created_at` (String) Timestamp of the environment creation, RFC3339 format. |
| 54 | +- `description` (String) The description of the environment. |
| 55 | +- `external_url` (String) Place to link to for this environment. |
| 56 | +- `flux_resource_path` (String) The Flux resource path to associate with this environment. |
| 57 | +- `id` (Number) The ID of the environment. |
| 58 | +- `kubernetes_namespace` (String) The Kubernetes namespace to associate with this environment. |
| 59 | +- `name` (String) The name of the environment. |
| 60 | +- `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. |
| 61 | +- `state` (String) The state of the environment. Value can be one of `available`, `stopping`, `stopped`. Returns all environments if not set. |
| 62 | +- `tier` (String) The tier of the environment. Value can be one of `production`, `staging`, `testing`, `development`, `other`. Returns all environments if not set. |
| 63 | +- `updated_at` (String) Timestamp of the last environment update, RFC3339 format. |
0 commit comments