Skip to content

Commit f173b17

Browse files
committed
refs platform/#3152: change gitlab_root_namespace with local project_path_with_namespace
1 parent 622fd6c commit f173b17

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ locals {
99

1010
final_namespace = var.create_namespace ? resource.kubernetes_namespace_v1.this[0].metadata[0].name : data.kubernetes_namespace_v1.this[0].metadata[0].name
1111

12-
use_existing_project = var.gitlab_project_name == "" ? 1 : 0
13-
project_id = local.use_existing_project == 1 ? data.gitlab_project.this[0].id : gitlab_project.project[0].id
12+
use_existing_project = var.gitlab_project_name == "" ? 1 : 0
13+
project_id = local.use_existing_project == 1 ? data.gitlab_project.this[0].id : gitlab_project.project[0].id
1414
project_path_with_namespace = local.use_existing_project == 1 ? data.gitlab_project.this[0].path_with_namespace : gitlab_project.project[0].path_with_namespace
15+
project_root_namespace = split("/", var.gitlab_project_path_with_namespace)[0]
1516

1617
gitlab_agent_token_name_computed = replace(var.gitlab_agent_token_name, "{{gitlab_agent_name}}", var.gitlab_agent_name)
1718
gitlab_agent_token_description_computed = replace(var.gitlab_agent_token_description, "{{gitlab_agent_name}}", var.gitlab_agent_name)
@@ -37,7 +38,7 @@ data "gitlab_project" "this" {
3738
}
3839

3940
data "gitlab_group" "root_namespace" {
40-
full_path = var.gitlab_root_namespace
41+
full_path = local.project_root_namespace
4142
}
4243

4344
resource "gitlab_project" "project" {

variables.tf

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ variable "gitlab_project_name" {
44
default = ""
55
}
66

7-
variable "gitlab_root_namespace" {
8-
description = "The full path of the root namespace in Gitlab. This is the namespace where the Gitlab Agent will be granted access."
9-
type = string
10-
}
11-
127
variable "gitlab_project_path_with_namespace" {
138
description = "The path with namespace of the Gitlab project that hosts the Gitlab Agent configuration. The project must be created in Gitlab before running this module. The configured Gitlab provider must have write access to the project."
149
type = string

0 commit comments

Comments
 (0)