Created
March 23, 2022 08:02
-
-
Save guivin/a1d92fa2302b87a9b33dab8b7385608d to your computer and use it in GitHub Desktop.
grafana.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
resource "kubernetes_secret" "grafana" { | |
metadata { | |
name = "grafana" | |
namespace = var.namespace | |
} | |
data = { | |
admin-user = "admin" | |
admin-password = random_password.grafana.result | |
} | |
} | |
resource "random_password" "grafana" { | |
length = 24 | |
} | |
resource "helm_release" "grafana" { | |
chart = "grafana" | |
name = "grafana" | |
repository = "https://grafana.github.io/helm-charts" | |
namespace = var.namespace | |
version = "6.24.1" | |
values = [ | |
templatefile("${path.module}/templates/grafana-values.yaml", { | |
admin_existing_secret = kubernetes_secret.grafana.metadata[0].name | |
admin_user_key = "admin-user" | |
admin_password_key = "admin-password" | |
prometheus_svc = "${helm_release.prometheus.name}-server" | |
replicas = 1 | |
}) | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment