Skip to content

Commit

Permalink
Update Chart. Remove template provider. Update providers.
Browse files Browse the repository at this point in the history
  • Loading branch information
bohdantverdyi committed Jan 24, 2023
1 parent bf3d1f4 commit 0c5adc7
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 27 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 18 additions & 0 deletions locals.tf
Original file line number Diff line number Diff line change
@@ -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
}
)
}
15 changes: 1 addition & 14 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -42,27 +42,14 @@ 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"
namespace = var.create_namespace ? kubernetes_namespace.namespace[0].id : var.namespace
}

data = {
ldap-toml = data.template_file.grafana_ldap_toml.rendered
ldap-toml = local.grafana_ldap_toml
}
}

Expand Down
9 changes: 1 addition & 8 deletions variables.tf
Original file line number Diff line number Diff line change
@@ -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" {
Expand Down
4 changes: 2 additions & 2 deletions versions.tf
Original file line number Diff line number Diff line change
@@ -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"
}
}

0 comments on commit 0c5adc7

Please sign in to comment.