Skip to content

Commit f2f5c4f

Browse files
Update docs for v18.2.0 release
1 parent 8a36276 commit f2f5c4f

29 files changed

+321
-28
lines changed

CHANGELOG.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,23 @@
1+
## 18.2.0 (2025-07-17)
2+
3+
### FEATURES (2 changes)
4+
5+
- datasource/gitlab_project_access_tokens: [Allows retrieving project access tokens](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/commit/cb2c4c67125ed482d3ef5fda10dadb3d8827a913) by @ruben.aleman ([merge request](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/2575))
6+
- resource/gitlab_project_container_registry_protection: [Allows managing container registry protections for a project](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/commit/f5c576a7074339a4f507cde8e1d06173059c1112) by @hristiyan.ivanov ([merge request](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/2481))
7+
8+
### IMPROVEMENTS (5 changes)
9+
10+
- resource/gitlab_project: [Added support for `ci_push_repository_for_job_token_allowed`](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/commit/ff388fbb53cce1bf4fc117cab0847fa8badc5c73) by @danilobuerger ([merge request](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/2582))
11+
- resource/gitlab_group_hook: [Add `emoji_events` support](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/commit/14668982ad0ef42998ed991dc6a6eebf5f58b9de) by @lllkq546449541 ([merge request](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/2401))
12+
- resource/gitlab_project_protected_environment: [Create new `deploy_access_levels_attribute` using an object list instead of nested blocks to enable easier operations with other resources. The existing `deploy_access_levels` is deprecated and will be removed in 19.0.](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/commit/dc0a666da4563169f3022713c1c7e5cdce86c89f) by @heidi.berry ([merge request](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/2472))
13+
- resource/gitlab_group_service_account: [Allow using custom emails with group service accounts](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/commit/d7ded4f95405819a64ba23095e1cfb97e08182d9) by @heidi.berry ([merge request](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/2566))
14+
- resource/gitlab_branch_protection: [Add `admin` push access level support](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/commit/17d5d6e00e6608b423d57fb1436d86a67ad4fdae) by @netflash ([merge request](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/2558))
15+
16+
### BUG FIXES (2 change)
17+
18+
- resource/gitlab_project_label: [Fixed a bug that caused a plan operation when a named color was used instead of a hex](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/commit/1a3936f31ef889f3dfc373388ba785240708a748) by @heidi.berry ([merge request](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/2571))
19+
- access token resources: [Fixed a bug where using an `unknown` value for `scopes` caused an error](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/commit/5b626dc61ac5f7c60509d109f49d4146ad4b4aa4) by @PatrickRice ([merge request](https://gitlab.com/gitlab-org/terraform-provider-gitlab/-/merge_requests/2556))
20+
121
## 18.1.1 (2025-06-20)
222

323
### BUG FIXES (1 change)

docs/data-sources/application.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The `gitlab_application` data source retrieves information about a gitlab applic
1717

1818
```terraform
1919
data "gitlab_application" "oidc" {
20-
application_id = 1
20+
id = 1
2121
}
2222
```
2323

docs/data-sources/group_hook.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ data "gitlab_group_hook" "example" {
4040
- `confidential_note_events` (Boolean) Invoke the hook for confidential notes events.
4141
- `custom_webhook_template` (String) Set a custom webhook template.
4242
- `deployment_events` (Boolean) Invoke the hook for deployment events.
43+
- `emoji_events` (Boolean) Invoke the hook for emoji events.
4344
- `enable_ssl_verification` (Boolean) Enable ssl verification when invoking the hook.
4445
- `group_id` (Number) The id of the group for the hook.
4546
- `id` (String) The ID of this resource.

docs/data-sources/group_hooks.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ Read-Only:
4646
- `confidential_note_events` (Boolean)
4747
- `custom_webhook_template` (String)
4848
- `deployment_events` (Boolean)
49+
- `emoji_events` (Boolean)
4950
- `enable_ssl_verification` (Boolean)
5051
- `group` (String)
5152
- `group_id` (Number)

docs/data-sources/group_ids.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ The `gitlab_group_ids` data source identification information for a given group,
1717

1818
```terraform
1919
resource "gitlab_group" "new_group" {
20-
// include required attributes
20+
name = "example-group"
21+
path = "example-path"
22+
description = "This is an example group"
2123
}
2224
2325
// use group IDs to get additional information, such as the GraphQL ID
Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
---
2+
# generated by https://github.com/hashicorp/terraform-plugin-docs
3+
page_title: "gitlab_project_access_tokens Data Source - terraform-provider-gitlab"
4+
subcategory: ""
5+
description: |-
6+
The gitlab_project_access_tokens data source allows to retrieve all project access tokens for a given project.
7+
Upstream API: GitLab REST API docs https://docs.gitlab.com/api/project_access_tokens/
8+
---
9+
10+
# gitlab_project_access_tokens (Data Source)
11+
12+
The `gitlab_project_access_tokens` data source allows to retrieve all project access tokens for a given project.
13+
14+
**Upstream API**: [GitLab REST API docs](https://docs.gitlab.com/api/project_access_tokens/)
15+
16+
## Example Usage
17+
18+
```terraform
19+
# Basic example: Retrieve all project access tokens
20+
data "gitlab_project_access_tokens" "all_tokens" {
21+
project = "my/example/project"
22+
}
23+
24+
# Example with state filtering: Only retrieve active tokens
25+
data "gitlab_project_access_tokens" "active_tokens" {
26+
project = "my/example/project"
27+
state = "active"
28+
}
29+
30+
# Example with state filtering: Only retrieve inactive tokens
31+
data "gitlab_project_access_tokens" "inactive_tokens" {
32+
project = "my/example/project"
33+
state = "inactive"
34+
}
35+
36+
# Output examples showing different ways to work with the data
37+
38+
# Get the total count of tokens
39+
output "token_count" {
40+
description = "Total number of project access tokens"
41+
value = length(data.gitlab_project_access_tokens.all_tokens.access_tokens)
42+
}
43+
44+
# Get only the names of active tokens
45+
output "active_token_names" {
46+
description = "Names of active project access tokens"
47+
value = [for token in data.gitlab_project_access_tokens.active_tokens.access_tokens : token.name]
48+
}
49+
50+
# Get detailed information about each token
51+
output "token_details" {
52+
description = "Detailed information about each access token"
53+
value = [
54+
for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : {
55+
id = token.id
56+
name = token.name
57+
description = token.description
58+
scopes = token.scopes
59+
active = token.active
60+
revoked = token.revoked
61+
created_at = token.created_at
62+
expires_at = token.expires_at
63+
access_level = token.access_level
64+
user_id = token.user_id
65+
last_used_at = token.last_used_at
66+
}
67+
]
68+
}
69+
70+
# Filter tokens programmatically to get only active and non-revoked tokens
71+
output "active_non_revoked_tokens" {
72+
description = "Only active and non-revoked tokens"
73+
value = [
74+
for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : token
75+
if token.active && !token.revoked
76+
]
77+
}
78+
79+
# Get tokens that expire within the next 30 days
80+
output "expiring_soon_tokens" {
81+
description = "Tokens that expire within the next 30 days"
82+
value = [
83+
for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : token
84+
if token.expires_at != "" && can(parseint(split("T", token.expires_at)[0], 10)) &&
85+
timeadd(timestamp(), "30d") > timeparse("2006-01-02", split("T", token.expires_at)[0])
86+
]
87+
}
88+
89+
# Get tokens with specific scopes
90+
output "api_tokens" {
91+
description = "Tokens that have API scope"
92+
value = [
93+
for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : token
94+
if contains(token.scopes, "api")
95+
]
96+
}
97+
98+
# Get tokens by access level
99+
output "maintainer_tokens" {
100+
description = "Tokens with maintainer access level"
101+
value = [
102+
for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : token
103+
if token.access_level == "maintainer"
104+
]
105+
}
106+
107+
# Get a summary of token statistics
108+
output "token_statistics" {
109+
description = "Summary statistics of project access tokens"
110+
value = {
111+
total_tokens = length(data.gitlab_project_access_tokens.all_tokens.access_tokens)
112+
active_tokens = length([for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : token if token.active])
113+
revoked_tokens = length([for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : token if token.revoked])
114+
expired_tokens = length([for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : token if token.expires_at != "" && can(parseint(split("T", token.expires_at)[0], 10)) && timeadd(timestamp(), "0d") > timeparse("2006-01-02", split("T", token.expires_at)[0])])
115+
tokens_by_level = {
116+
for level in distinct([for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : token.access_level]) : level => length([for token in data.gitlab_project_access_tokens.all_tokens.access_tokens : token if token.access_level == level])
117+
}
118+
}
119+
}
120+
```
121+
122+
<!-- schema generated by tfplugindocs -->
123+
## Schema
124+
125+
### Required
126+
127+
- `project` (String) The name or id of the project.
128+
129+
### Optional
130+
131+
- `state` (String) List all project access token that match the specified state. Valid values are `active`, `inactive`. Returns all project access token if not set.
132+
133+
### Read-Only
134+
135+
- `access_tokens` (List of Object) The list of access tokens returned by the search (see [below for nested schema](#nestedatt--access_tokens))
136+
- `id` (String) The ID of this Terraform resource.
137+
138+
<a id="nestedatt--access_tokens"></a>
139+
### Nested Schema for `access_tokens`
140+
141+
Read-Only:
142+
143+
- `access_level` (String)
144+
- `active` (Boolean)
145+
- `created_at` (String)
146+
- `description` (String)
147+
- `expires_at` (String)
148+
- `id` (String)
149+
- `last_used_at` (String)
150+
- `name` (String)
151+
- `project` (String)
152+
- `revoked` (Boolean)
153+
- `scopes` (Set of String)
154+
- `user_id` (Number)

docs/data-sources/project_ids.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ The `gitlab_project_ids` data source identification information for a given proj
1717

1818
```terraform
1919
resource "gitlab_project" "new_project" {
20-
// include required attributes
20+
name = "project"
2121
}
2222
2323
// use project IDs to get additional information, such as the GraphQL ID

docs/data-sources/project_protected_branch.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ Optional:
5656

5757
Read-Only:
5858

59-
- `access_level` (String) Access levels allowed to merge to protected branch. Valid values are: `no one`, `developer`, `maintainer`.
59+
- `access_level` (String) Access levels allowed to merge to protected branch. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
6060
- `access_level_description` (String) Readable description of access level.
6161

6262

@@ -71,5 +71,5 @@ Optional:
7171

7272
Read-Only:
7373

74-
- `access_level` (String) Access levels allowed to push to protected branch. Valid values are: `no one`, `developer`, `maintainer`.
74+
- `access_level` (String) Access levels allowed to push to protected branch. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
7575
- `access_level_description` (String) Readable description of access level.

docs/data-sources/project_protected_branches.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ Optional:
6565

6666
Read-Only:
6767

68-
- `access_level` (String) Access levels allowed to merge to protected branch. Valid values are: `no one`, `developer`, `maintainer`.
68+
- `access_level` (String) Access levels allowed to merge to protected branch. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
6969
- `access_level_description` (String) Readable description of access level.
7070

7171

@@ -80,5 +80,5 @@ Optional:
8080

8181
Read-Only:
8282

83-
- `access_level` (String) Access levels allowed to push to protected branch. Valid values are: `no one`, `developer`, `maintainer`.
83+
- `access_level` (String) Access levels allowed to push to protected branch. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
8484
- `access_level_description` (String) Readable description of access level.

docs/resources/branch_protection.md

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,15 @@ resource "gitlab_branch_protection" "main" {
7777
}
7878
}
7979
}
80+
81+
# Example with admin push access level
82+
resource "gitlab_branch_protection" "admin_push" {
83+
project = "12345"
84+
branch = "admin-protected"
85+
push_access_level = "admin"
86+
merge_access_level = "maintainer"
87+
unprotect_access_level = "maintainer"
88+
}
8089
```
8190

8291
<!-- schema generated by tfplugindocs -->
@@ -94,8 +103,8 @@ resource "gitlab_branch_protection" "main" {
94103
- `allowed_to_push` (Block Set) Array of access levels and user(s)/group(s) allowed to push to protected branch. (see [below for nested schema](#nestedblock--allowed_to_push))
95104
- `allowed_to_unprotect` (Block Set) Array of access levels and user(s)/group(s) allowed to unprotect push to protected branch. (see [below for nested schema](#nestedblock--allowed_to_unprotect))
96105
- `code_owner_approval_required` (Boolean) Can be set to true to require code owner approval before merging. Only available for Premium and Ultimate instances.
97-
- `merge_access_level` (String) Access levels allowed to merge. Valid values are: `no one`, `developer`, `maintainer`.
98-
- `push_access_level` (String) Access levels allowed to push. Valid values are: `no one`, `developer`, `maintainer`.
106+
- `merge_access_level` (String) Access levels allowed to merge. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
107+
- `push_access_level` (String) Access levels allowed to push. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
99108
- `unprotect_access_level` (String) Access levels allowed to unprotect. Valid values are: `developer`, `maintainer`, `admin`.
100109

101110
### Read-Only
@@ -113,7 +122,7 @@ Optional:
113122

114123
Read-Only:
115124

116-
- `access_level` (String) Access levels allowed to merge to protected branch. Valid values are: `no one`, `developer`, `maintainer`.
125+
- `access_level` (String) Access levels allowed to merge to protected branch. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
117126
- `access_level_description` (String) Readable description of access level.
118127

119128

@@ -128,7 +137,7 @@ Optional:
128137

129138
Read-Only:
130139

131-
- `access_level` (String) Access levels allowed to push to protected branch. Valid values are: `no one`, `developer`, `maintainer`.
140+
- `access_level` (String) Access levels allowed to push to protected branch. Valid values are: `no one`, `developer`, `maintainer`, `admin`.
132141
- `access_level_description` (String) Readable description of access level.
133142

134143

0 commit comments

Comments
 (0)