Skip to content

Commit 606e81b

Browse files
committed
refs sparkfabrik-innovation-team/board#3833: update CHANGELOG and README with new variables and configuration modes; deprecate old variables
1 parent 58f5f90 commit 606e81b

File tree

3 files changed

+71
-2
lines changed

3 files changed

+71
-2
lines changed

CHANGELOG.md

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

99
## [Unreleased]
1010

11+
### Added
12+
13+
- New variable `operate_at_root_group_level` to simplify configuration and replace the combination of `gitlab_agent_grant_access_to_entire_root_namespace` and `gitlab_agent_create_variables_in_root_namespace`
14+
- New variable `groups_enabled` to specify groups where the GitLab Agent should be enabled (when not operating at root group level)
15+
- New variable `projects_enabled` to specify projects where the GitLab Agent should be enabled (when not operating at root group level)
16+
- Auto-detection of parent group when `operate_at_root_group_level = false` and no groups/projects are specified
17+
- Support for creating CI/CD variables in multiple groups and projects simultaneously
18+
- Dynamic generation of agent configuration file based on enabled groups/projects using `yamlencode()`
19+
- New outputs: `gitlab_enabled_groups`, `gitlab_enabled_projects`, `gitlab_parent_group_auto_detected`, `operate_at_root_group_level`
20+
21+
### Changed
22+
23+
- Agent configuration file is now dynamically generated based on `operate_at_root_group_level` and enabled groups/projects
24+
- CI/CD variables can now be created in multiple targets (root group, specific groups, or specific projects) depending on configuration
25+
- Output `gitlab_root_namespace_id` now returns `null` when not operating at root group level
26+
27+
### Deprecated
28+
29+
- Variable `gitlab_agent_grant_access_to_entire_root_namespace` - use `operate_at_root_group_level` instead
30+
- Variable `gitlab_agent_create_variables_in_root_namespace` - behavior is now determined by `operate_at_root_group_level`
31+
1132
## [0.12.0] - 2025-05-19
1233

1334
[Compare with previous version](https://github.com/sparkfabrik/terraform-gitlab-kubernetes-gitlab-agent/compare/0.11.0...0.12.0)

README.md

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,60 @@ This module creates all the necessary resources to deploy a Gitlab Agent on a Ku
44

55
It uses the Gitlab provider to register the agent on the Gitlab server. The generated registration token is use to create an Helm release of the Gitlab Agent in the cluster.
66

7-
If required (`gitlab_agent_grant_access_to_entire_root_namespace` configured to `true`), it also creates the necessary configuration files in the given Gitlab project, granting access to all the projects in the root namespace and subgroups.
7+
The module supports multiple configuration modes:
8+
9+
- **Root Group Level** (default): The agent has access to the entire root namespace and CI/CD variables are created in the root group
10+
- **Auto-detect Parent**: When not operating at root level and no specific groups/projects are provided, the module automatically detects the parent group of the agent project
11+
- **Specific Groups/Projects**: Enable the agent only for specific groups or projects, with variables created in those locations
812

913
**ATTENTION**: you have to manually create the project that will host the Gitlab Agent configuration in Gitlab before running this module.
1014

1115
From version `0.7.0`, if you set `gitlab_project_name` the module will create Gitlab project automatically. This new behavior requires the provider to have the proper permissions to create the project in the namespace.
1216

17+
## Configuration Examples
18+
19+
### Example 1: Root Group (Default)
20+
```hcl
21+
module "gitlab_agent" {
22+
source = "github.com/sparkfabrik/terraform-gitlab-kubernetes-gitlab-agent"
23+
24+
gitlab_project_path_with_namespace = "my-org/agents-project"
25+
gitlab_agent_name = "production-agent"
26+
namespace = "gitlab-agent"
27+
}
28+
```
29+
30+
### Example 2: Auto-detect Parent Group
31+
```hcl
32+
module "gitlab_agent" {
33+
source = "github.com/sparkfabrik/terraform-gitlab-kubernetes-gitlab-agent"
34+
35+
gitlab_project_path_with_namespace = "my-org/team-a/subgroup/agents"
36+
gitlab_agent_name = "team-agent"
37+
namespace = "gitlab-agent"
38+
39+
operate_at_root_group_level = false
40+
# Parent group "my-org/team-a/subgroup" will be automatically detected
41+
}
42+
```
43+
44+
### Example 3: Specific Groups
45+
```hcl
46+
module "gitlab_agent" {
47+
source = "github.com/sparkfabrik/terraform-gitlab-kubernetes-gitlab-agent"
48+
49+
gitlab_project_path_with_namespace = "my-org/infrastructure/agents"
50+
gitlab_agent_name = "shared-agent"
51+
namespace = "gitlab-agent"
52+
53+
operate_at_root_group_level = false
54+
groups_enabled = [
55+
"my-org/team-a",
56+
"my-org/team-b"
57+
]
58+
}
59+
```
60+
1361
## RBAC configuration for the Gitlab Agent service account
1462

1563
This module uses the default configuration of the Gitlab Agent Helm chart. The default configuration grants to the Gitlab Agent service account the `cluster-admin` ClusterRole. If you want to change this configuration, you can use the `helm_additional_values` variable to pass additional values to the Helm chart.

variables.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ variable "projects_enabled" {
5050
}
5151

5252
variable "gitlab_agent_grant_user_access_to_root_namespace" {
53-
description = "Grant `user_access` to the root namespace."
53+
description = "DEPRECATED: Use operate_at_root_group_level instead.Grant `user_access` to the root namespace."
5454
type = bool
5555
default = false
5656
}

0 commit comments

Comments
 (0)