-
Notifications
You must be signed in to change notification settings - Fork 0
/
monitoring.tf
58 lines (54 loc) · 1.57 KB
/
monitoring.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
resource "kubernetes_namespace" "monitoring" {
metadata {
name = var.monitoring_namespace
}
}
resource "helm_release" "prometheus" {
name = "prometheus"
repository = "https://prometheus-community.github.io/helm-charts"
chart = "prometheus"
version = var.prometheus_chart_version
namespace = kubernetes_namespace.monitoring.id
values = [
templatefile("${path.root}/templates/monitoring/prometheus/prometheus.tpl", {
nodePort = var.prometheus_nodePort
})
]
}
resource "helm_release" "grafana" {
name = "grafana"
repository = "https://grafana.github.io/helm-charts"
chart = "grafana"
version = var.grafana_chart_version
namespace = kubernetes_namespace.monitoring.id
values = [
templatefile("${path.root}/templates/monitoring/grafana/grafana.tpl", {
nodePort = var.grafana_nodePort,
prometheusVersion = var.prometheus_chart_version
})
]
}
resource "kubernetes_config_map" "k8s-dashboard" {
metadata {
name = "k8s-dashboard"
namespace = kubernetes_namespace.monitoring.id
labels = {
grafana_dashboard = "dashboard"
}
}
data = {
"k8s.json" = "${file("${path.module}/templates/monitoring/grafana/dashboards/k8s.json")}"
}
}
resource "kubernetes_config_map" "jenkins-dashboard" {
metadata {
name = "jenkins-dashboard"
namespace = kubernetes_namespace.monitoring.id
labels = {
grafana_dashboard = "dashboard"
}
}
data = {
"jenkins.json" = "${file("${path.module}/templates/monitoring/grafana/dashboards/jenkins.json")}"
}
}