Skip to content

Commit 6da075f

Browse files
feat: remove autoassign current user by default
1 parent 7c5c0b1 commit 6da075f

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
88

99
## [Unreleased]
1010

11+
## [1.2.0] - 2025-10-13
12+
13+
[Compare with previous version](https://github.com/sparkfabrik/terraform-gitlab-kubernetes-gitlab-agent/compare/1.1.0...1.2.0)
14+
15+
### Added
16+
17+
- feat: remove autoassign current user by default
18+
1119
## [1.1.0] - 2025-10-08
1220

1321
[Compare with previous version](https://github.com/sparkfabrik/terraform-gitlab-kubernetes-gitlab-agent/compare/1.0.0...1.1.0)

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ provider "gitlab" {
7777

7878
## GitLab Agents user membership
7979

80-
The current user used by the provider is automatically added as `maintainer` to the "GitLab Agents" project. If you don't want this behavior, just set the variable `var.autoassign_current_user_as_maintainer` to `false`.
80+
The current user used by the provider must be added as `maintainer` to the "GitLab Agents" project. This behavior by default is disable, just set the variable `var.autoassign_current_user_as_maintainer` to `true` if you want enable.
8181

8282
Adding the user as `maintainer` to the newly created project ensures they have the permissions to commit and push to it.
8383

84-
**ATTENTION:** If the current user is already added to the project but with a different role than `maintainer`, the apply will fail saying that a membership already exists
84+
**ATTENTION:** If the current user is already added to the project the apply will fail saying that a membership already exists
8585

8686
<!-- BEGIN_TF_DOCS -->
8787
## Providers

main.tf

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ locals {
5151
(var.gitlab_agent_variable_name_agent_id) : gitlab_cluster_agent.this.name,
5252
(var.gitlab_agent_variable_name_agent_project) : local.project_path_with_namespace,
5353
}
54-
55-
current_user_is_maintainer_of_project = length([for member in data.gitlab_project_membership.this.members : member if member.name == data.gitlab_current_user.this.name && member.access_level == "maintainer"]) > 0
5654
}
5755

5856
# Gitlab resources
@@ -99,7 +97,7 @@ resource "gitlab_project" "project" {
9997
}
10098

10199
resource "gitlab_project_membership" "project" {
102-
count = var.autoassign_current_user_as_maintainer && !local.current_user_is_maintainer_of_project ? 1 : 0
100+
count = var.autoassign_current_user_as_maintainer ? 1 : 0
103101
project = local.project_id
104102
user_id = data.gitlab_current_user.this.id
105103
access_level = "maintainer"

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,5 +159,5 @@ variable "create_default_pod_anti_affinity" {
159159
variable "autoassign_current_user_as_maintainer" {
160160
description = "Automatically assign the current GitLab user (from the GitLab provider) as a maintainer of the created project. This is useful to ensure that the user has rights to commit and push the GitLab Agent configuration file."
161161
type = bool
162-
default = true
162+
default = false
163163
}

0 commit comments

Comments
 (0)