@@ -28,12 +28,7 @@ locals {
2828}
2929
3030# Gitlab resources
31-
32- resource "gitlab_project" "project" {
33- count = local. use_existing_project == 0 ? 1 : 0
34- name = var. gitlab_project_name
35- namespace_id = data. gitlab_group . root_namespace . group_id
36- }
31+ data "gitlab_metadata" "this" {}
3732
3833data "gitlab_project" "this" {
3934 count = local. use_existing_project
@@ -45,6 +40,12 @@ data "gitlab_group" "root_namespace" {
4540 full_path = var. gitlab_root_namespace
4641}
4742
43+ resource "gitlab_project" "project" {
44+ count = local. use_existing_project == 0 ? 1 : 0
45+ name = var. gitlab_project_name
46+ namespace_id = data. gitlab_group . root_namespace . group_id
47+ }
48+
4849resource "gitlab_cluster_agent" "this" {
4950 project = local. project_id
5051 name = var. gitlab_agent_name
@@ -141,7 +142,7 @@ resource "helm_release" "this" {
141142 {
142143 k8s_common_labels = local.k8s_common_labels
143144 agent_replicas = var.agent_replicas
144- agent_kas_address = var.agent_kas_address
145+ agent_kas_address = data.gitlab_metadata.this.kas.external_url
145146 agent_token_secret_name = kubernetes_secret_v1.gitlab_agent_token_secret.metadata[0 ].name
146147 # Variables used to configure the default podAntiAffinity for the Gitlab Agent
147148 create_default_pod_anti_affinity = var.create_default_pod_anti_affinity
0 commit comments