From 0c5adc7961b4a6edea2c76f4bd855791d5c0255f Mon Sep 17 00:00:00 2001 From: Bohdan Tverdyi Date: Tue, 24 Jan 2023 18:57:35 +0200 Subject: [PATCH] Update Chart. Remove template provider. Update providers. --- README.md | 6 +++--- locals.tf | 18 ++++++++++++++++++ main.tf | 15 +-------------- variables.tf | 9 +-------- versions.tf | 4 ++-- 5 files changed, 25 insertions(+), 27 deletions(-) create mode 100644 locals.tf diff --git a/README.md b/README.md index f3978ef..764302a 100644 --- a/README.md +++ b/README.md @@ -11,9 +11,9 @@ Also, optional (default ***false***), you can enable grafana ldap module to gran Name | Description --- | --- | -Terraform | >= 0.14.9 -Helm provider | >= 2.1.0 -Kubernetes provider | >= 1.11.1 +Terraform | >= 1.0.0 +Helm provider | >= 2.5.0 +Kubernetes provider | >= 2.1.0 ## Usage diff --git a/locals.tf b/locals.tf new file mode 100644 index 0000000..6932413 --- /dev/null +++ b/locals.tf @@ -0,0 +1,18 @@ +locals { + prometheus_chart = "kube-prometheus-stack" + prometheus_repository = "https://prometheus-community.github.io/helm-charts" + grafana_ldap_auth = [var.grafana_ldap_enable ? file("${path.module}/templates/grafana.yaml") : ""] + + grafana_ldap_toml = templatefile( + "${path.module}/templates/ldap.toml", + { + host = var.grafana_ldap_host + bind_dn = var.grafana_ldap_bind_dn + bind_password = var.grafana_ldap_bind_password + search_base_dn = var.grafana_ldap_search_base_dn + search_filter = var.grafana_ldap_search_filter + admin_group_dn = var.grafana_ldap_admin_group_dn + editor_group_dn = var.grafana_ldap_editor_group_dn + } + ) +} \ No newline at end of file diff --git a/main.tf b/main.tf index 349c3e3..3d7de5e 100644 --- a/main.tf +++ b/main.tf @@ -42,19 +42,6 @@ resource "kubernetes_config_map" "grafana_additional_datasource" { } } -data "template_file" "grafana_ldap_toml" { - template = file("${path.module}/templates/ldap.toml") - vars = { - host = var.grafana_ldap_host - bind_dn = var.grafana_ldap_bind_dn - bind_password = var.grafana_ldap_bind_password - search_base_dn = var.grafana_ldap_search_base_dn - search_filter = var.grafana_ldap_search_filter - admin_group_dn = var.grafana_ldap_admin_group_dn - editor_group_dn = var.grafana_ldap_editor_group_dn - } -} - resource "kubernetes_secret" "grafana_ldap_toml" { metadata { name = "prometheus-operator-grafana-ldap-toml" @@ -62,7 +49,7 @@ resource "kubernetes_secret" "grafana_ldap_toml" { } data = { - ldap-toml = data.template_file.grafana_ldap_toml.rendered + ldap-toml = local.grafana_ldap_toml } } diff --git a/variables.tf b/variables.tf index 8c47648..ef71acd 100644 --- a/variables.tf +++ b/variables.tf @@ -1,14 +1,7 @@ -locals { - prometheus_chart = "kube-prometheus-stack" - prometheus_repository = "https://prometheus-community.github.io/helm-charts" - grafana_ldap_auth = [var.grafana_ldap_enable ? file("${path.module}/templates/grafana.yaml") : ""] -} - - variable "prometheus_chart_version" { description = "Chart version" type = string - default = "19.2.3" + default = "44.3.0" } variable "additional_set" { diff --git a/versions.tf b/versions.tf index 88c4910..814e64d 100644 --- a/versions.tf +++ b/versions.tf @@ -1,8 +1,8 @@ terraform { - required_version = ">= 0.14.9" + required_version = ">= 1.0.0" required_providers { kubernetes = ">= 2.1.0" - helm = ">= 1.11.1" + helm = ">= 2.5.0" } } \ No newline at end of file