Skip to content

Commit 601187e

Browse files
committed
fix: set empty string for helper local variables when no gitlab projects provided
1 parent 88121eb commit 601187e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

deploy.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
locals {
22
gitlab_project_ids = toset(concat(var.gitlab_project_ids, var.gitlab_project_id != "" ? [var.gitlab_project_id] : []))
3-
first_project_web_url = data.gitlab_project.this[element(keys(data.gitlab_project.this), 0)].web_url
4-
gitlab_domain = regex("https://([^/]+)/.*", local.first_project_web_url)[0]
3+
first_project_web_url = length(local.gitlab_project_ids) > 0 ? data.gitlab_project.this[element(keys(data.gitlab_project.this), 0)].web_url : ""
4+
gitlab_domain = length(local.gitlab_project_ids) > 0 ? regex("https://([^/]+)/.*", local.first_project_web_url)[0] : ""
55
}
66

77
data "gitlab_project" "this" {

0 commit comments

Comments
 (0)