Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ locals {
}

# Gitlab resources
data "gitlab_current_user" "this" {}

data "gitlab_metadata" "this" {}

data "gitlab_project" "this" {
Expand Down Expand Up @@ -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
Expand Down
6 changes: 6 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -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
}