Skip to content

Commit 798d7f4

Browse files
refs platform/board#3920: add GitLab provider user as Maintainers of project (#23)
1 parent 9b167b2 commit 798d7f4

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
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.1.0] - 2025-10-08
12+
13+
[Compare with previous version](https://github.com/sparkfabrik/terraform-gitlab-kubernetes-gitlab-agent/compare/1.0.0...1.1.0)
14+
15+
### Added
16+
17+
- refs platform/board#3920: add GitLab provider user as Maintainers of `local.project_id` project.
18+
1119
## [1.0.0] - 2025-10-02
1220

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

main.tf

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ locals {
5454
}
5555

5656
# Gitlab resources
57+
data "gitlab_current_user" "this" {}
58+
5759
data "gitlab_metadata" "this" {}
5860

5961
data "gitlab_project" "this" {
@@ -89,6 +91,13 @@ resource "gitlab_project" "project" {
8991
namespace_id = var.operate_at_root_group_level ? data.gitlab_group.root_namespace.group_id : data.gitlab_group.parent_group[0].group_id
9092
}
9193

94+
resource "gitlab_project_membership" "project" {
95+
count = var.autoassign_current_user_as_maintainer ? 1 : 0
96+
project = local.project_id
97+
user_id = data.gitlab_current_user.this.id
98+
access_level = "maintainer"
99+
}
100+
92101
resource "gitlab_cluster_agent" "this" {
93102
project = local.project_id
94103
name = var.gitlab_agent_name

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,9 @@ variable "create_default_pod_anti_affinity" {
155155
type = bool
156156
default = true
157157
}
158+
159+
variable "autoassign_current_user_as_maintainer" {
160+
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."
161+
type = bool
162+
default = true
163+
}

0 commit comments

Comments
 (0)