diff --git a/CHANGELOG.md b/CHANGELOG.md index 30b9fa2..64d7c64 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,14 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [1.1.0] - 2025-10-08 + +[Compare with previous version](https://github.com/sparkfabrik/terraform-gitlab-kubernetes-gitlab-agent/compare/1.0.0...1.1.0) + +### Added + +- refs platform/board#3920: add GitLab provider user as Maintainers of `local.project_id` project. + ## [1.0.0] - 2025-10-02 [Compare with previous version](https://github.com/sparkfabrik/terraform-gitlab-kubernetes-gitlab-agent/compare/0.13.0...1.0.0) diff --git a/main.tf b/main.tf index fc7b82a..122db62 100644 --- a/main.tf +++ b/main.tf @@ -54,6 +54,8 @@ locals { } # Gitlab resources +data "gitlab_current_user" "this" {} + data "gitlab_metadata" "this" {} data "gitlab_project" "this" { @@ -89,6 +91,13 @@ resource "gitlab_project" "project" { namespace_id = var.operate_at_root_group_level ? data.gitlab_group.root_namespace.group_id : data.gitlab_group.parent_group[0].group_id } +resource "gitlab_project_membership" "project" { + count = var.autoassign_current_user_as_maintainer ? 1 : 0 + project = local.project_id + user_id = data.gitlab_current_user.this.id + access_level = "maintainer" +} + resource "gitlab_cluster_agent" "this" { project = local.project_id name = var.gitlab_agent_name diff --git a/variables.tf b/variables.tf index 5d57284..f755e21 100644 --- a/variables.tf +++ b/variables.tf @@ -155,3 +155,9 @@ variable "create_default_pod_anti_affinity" { type = bool default = true } + +variable "autoassign_current_user_as_maintainer" { + 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." + type = bool + default = true +}