-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
114 lines (95 loc) · 3.02 KB
/
main.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
resource "kubernetes_namespace" "loki" {
metadata {
name = "loki"
}
}
resource "kubernetes_namespace" "grafana" {
metadata {
name = "grafana"
}
}
resource "kubernetes_namespace" "tempo" {
metadata {
name = "tempo"
}
}
resource "kubernetes_namespace" "mimir" {
metadata {
name = "mimir"
}
}
resource "kubernetes_namespace" "victoria" {
metadata {
name = "victoria"
}
}
resource "google_storage_bucket" "loki" {
count = var.loki_enabled ? 1 : 0
name = local.loki_resource_label
location = var.bucket_location
force_destroy = true
}
resource "google_storage_bucket" "mimir" {
count = var.loki_enabled ? 1 : 0
name = local.mimir_resource_label
location = var.bucket_location
force_destroy = true
}
resource "helm_release" "loki" {
count = var.loki_enabled ? 1 : 0
version = var.loki_helm_chart_version
name = "loki-distributed"
chart = "loki-distributed"
repository = "https://grafana.github.io/helm-charts"
namespace = kubernetes_namespace.loki.metadata[0].name
values = [data.template_file.loki_values[0].rendered]
depends_on = [module.loki-identity]
}
resource "helm_release" "grafana" {
depends_on = [kubernetes_namespace.grafana, module.docker_creds]
version = var.grafan_helm_chart_version
name = "grafana"
chart = "grafana"
repository = "https://grafana.github.io/helm-charts"
namespace = kubernetes_namespace.grafana.metadata[0].name
values = [data.template_file.grafana_values[0].rendered]
set_sensitive {
name = "grafana\\.ini.database.url"
value = format("postgres://%s:%[email protected]:5432/%s", var.db_username, var.db_password, var.db_name)
}
set_sensitive {
name = "adminPassword"
value = var.admin_password
}
}
resource "helm_release" "tempo" {
depends_on = [
module.tempo-identity,
data.template_file.tempo_values
]
version = var.temp_helm_chart_version
name = "tempo-distributed"
chart = "tempo-distributed"
repository = "https://grafana.github.io/helm-charts"
namespace = kubernetes_namespace.tempo.metadata[0].name
values = [data.template_file.tempo_values[0].rendered]
force_update = true
}
# https://artifacthub.io/packages/helm/prometheus-community/kube-state-metrics
resource "helm_release" "kube-state-metrics" {
count = var.kube_state_metrics_enabled ? 1 : 0
name = "kube-state-metrics"
chart = "kube-state-metrics"
namespace = "default"
repository = "https://prometheus-community.github.io/helm-charts"
version = var.kube_state_metrics_chart_version
}
resource "helm_release" "victoria_operator" {
version = var.victoria_operator_version
name = "vm-operator"
chart = "victoria-metrics-operator"
repository = "https://victoriametrics.github.io/helm-charts"
namespace = kubernetes_namespace.victoria.metadata[0].name
recreate_pods = true
values = [data.template_file.victoria_values[0].rendered]
}