From 400d944e7c0b0a0c66c97d5187eee2382e8b1164 Mon Sep 17 00:00:00 2001 From: junior Date: Wed, 7 Sep 2022 02:41:19 -0500 Subject: [PATCH 1/2] cluster-tools update Signed-off-by: junior --- module-cluster-tools.tf | 6 ++++++ modules/cluster-tools/grafana.tf | 22 +++++++++++++++++++++- modules/cluster-tools/ingress-nginx.tf | 13 ++++++++++++- 3 files changed, 39 insertions(+), 2 deletions(-) diff --git a/module-cluster-tools.tf b/module-cluster-tools.tf index 2a26486..c8e5289 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..add2fe5 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, helm_release.mushop] + + count = var.grafana_enabled ? 1 : 0 +} + +locals { + grafana_admin_password = var.grafana_enabled ? data.kubernetes_secret.mushop_utils_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 +} From 8e0c6a3071241b9301c15d88a3ead51ca17d8ba1 Mon Sep 17 00:00:00 2001 From: junior Date: Fri, 9 Sep 2022 12:04:35 -0500 Subject: [PATCH 2/2] grafana simplification Signed-off-by: junior --- module-cluster-tools.tf | 2 +- modules/cluster-tools/grafana.tf | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/module-cluster-tools.tf b/module-cluster-tools.tf index c8e5289..ccb00e2 100644 --- a/module-cluster-tools.tf +++ b/module-cluster-tools.tf @@ -80,6 +80,6 @@ variable "grafana_enabled" { # Cluster Tools Outputs output "grafana_admin_password" { - value = module.cluster-tools.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 add2fe5..e091a8b 100644 --- a/modules/cluster-tools/grafana.tf +++ b/modules/cluster-tools/grafana.tf @@ -155,13 +155,13 @@ data "kubernetes_secret" "grafana" { name = "grafana" namespace = kubernetes_namespace.cluster_tools.id } - depends_on = [helm_release.grafana, helm_release.mushop] + depends_on = [helm_release.grafana] count = var.grafana_enabled ? 1 : 0 } locals { - grafana_admin_password = var.grafana_enabled ? data.kubernetes_secret.mushop_utils_grafana.0.data.admin-password : "Grafana_Not_Deployed" + grafana_admin_password = var.grafana_enabled ? data.kubernetes_secret.grafana.0.data.admin-password : "Grafana_Not_Deployed" } output "grafana_admin_password" {