diff --git a/main.tf b/main.tf index 0c230bb..3082785 100644 --- a/main.tf +++ b/main.tf @@ -2,6 +2,9 @@ locals { internal_hostname = format("%v.%v.svc.cluster.local", var.service_name, var.namespace) internal_port_number = "20001" internal_url = format("http://%s:%s/", local.internal_hostname, local.internal_port_number) + # This may seem unusual, but we cannot input/pass the grafana ingress url, since kiali is a dependency of gatekeeper + # that creates the ingress (circular dep). So, we build the ingress url here using the same variables as gatekeeper. + grafana_public_url = format("https://%s.%s", var.grafana_service_name, var.cluster_domain) } resource "helm_release" "kiali_operator" { @@ -57,7 +60,7 @@ resource "helm_release" "kiali_operator" { } set { name = "grafana.externalUrl" - value = var.grafana_public_url + value = local.grafana_public_url } set { name = "grafana.internalUrl" @@ -96,7 +99,7 @@ resource "helm_release" "kiali" { } set { name = "grafana.externalUrl" - value = var.grafana_public_url + value = local.grafana_public_url } set { name = "grafana.internalUrl" diff --git a/variables.tf b/variables.tf index 2168d18..1736c2a 100644 --- a/variables.tf +++ b/variables.tf @@ -31,14 +31,15 @@ variable "grafana_secret_name" { type = string } -variable "grafana_public_url" { - description = "The URL incoming traffic from outisde the cluster uses to access grafana." +variable "grafana_internal_url" { + description = "The url within the cluster to use to access grafana." type = string } -variable "grafana_internal_url" { - description = "The url within the cluster to use to access grafana." +variable "grafana_service_name" { + description = "The name of the service used for grafana." type = string + default = "grafana" } variable "prometheus_internal_url" {