diff --git a/module-cluster-tools.tf b/module-cluster-tools.tf index 2a26486..ccb00e2 100644 --- a/module-cluster-tools.tf +++ b/module-cluster-tools.tf @@ -77,3 +77,9 @@ variable "grafana_enabled" { default = false description = "Enable Grafana Dashboards. Includes example dashboards and Prometheus, OCI Logging and OCI Metrics datasources" } + +# Cluster Tools Outputs +output "grafana_admin_password" { + value = module.cluster-tools.grafana_admin_password + sensitive = true +} \ No newline at end of file diff --git a/modules/cluster-tools/grafana.tf b/modules/cluster-tools/grafana.tf index 8d14ff3..e091a8b 100644 --- a/modules/cluster-tools/grafana.tf +++ b/modules/cluster-tools/grafana.tf @@ -147,4 +147,24 @@ EOF ] count = var.grafana_enabled ? 1 : 0 -} \ No newline at end of file +} + +## Kubernetes Secret: Grafana Admin Password +data "kubernetes_secret" "grafana" { + metadata { + name = "grafana" + namespace = kubernetes_namespace.cluster_tools.id + } + depends_on = [helm_release.grafana] + + count = var.grafana_enabled ? 1 : 0 +} + +locals { + grafana_admin_password = var.grafana_enabled ? data.kubernetes_secret.grafana.0.data.admin-password : "Grafana_Not_Deployed" +} + +output "grafana_admin_password" { + value = var.grafana_enabled ? local.grafana_admin_password : null + sensitive = true +} diff --git a/modules/cluster-tools/ingress-nginx.tf b/modules/cluster-tools/ingress-nginx.tf index c8262e3..663ca99 100644 --- a/modules/cluster-tools/ingress-nginx.tf +++ b/modules/cluster-tools/ingress-nginx.tf @@ -71,4 +71,15 @@ resource "helm_release" "ingress_nginx" { } count = var.ingress_nginx_enabled ? 1 : 0 -} \ No newline at end of file +} + +## Kubernetes Service: ingress-nginx-controller +data "kubernetes_service" "ingress" { + metadata { + name = "ingress-nginx-controller" + namespace = kubernetes_namespace.cluster_tools.id + } + depends_on = [helm_release.ingress_nginx] + + count = var.ingress_nginx_enabled ? 1 : 0 +}