-
Notifications
You must be signed in to change notification settings - Fork 1
/
variables.tf
270 lines (260 loc) · 9.02 KB
/
variables.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
variable "project_id" {
type = string
description = "The Project ID to create this module's resource in"
}
variable "database" {
type = string
}
variable "app_name" {
type = string
description = "Name of the application"
default = ""
}
variable "environment" {
type = string
description = "Environment"
default = ""
}
variable "dashboard_displayname" {
type = string
description = "Environment"
default = "Custom CloudSQL Dashboard"
}
variable "create_dashboard" {
description = "Boolean to control the creation of the dashboard"
type = bool
default = true
}
variable "notification_email" {
description = "List of email addresses for creating notification channels"
type = list(string)
default = []
}
variable "notification_channel" {
description = "Map of email addresses to their corresponding display names"
type = map(string)
default = {
# "[email protected]" = "User One"
}
}
variable "alert_durations" {
type = object({
#sql_uptime_alert_duration = string
sql_server_up_alert_duration = string
sql_cpu_alert_duration = string
sql_memory_alert_duration = string
sql_disk_utilization_alert_duration = string
sql_disk_quota_alert_duration = string
sql_memory_quota_alert_duration = string
sql_postgres_connections_alert_duration = string
sql_instance_state_alert_duration = string
sql_replica_lag_alert_duration = string
})
description = "Duration values for all alerts"
default = {
#sql_uptime_alert_duration = "120s"
sql_server_up_alert_duration = "60s"
sql_cpu_alert_duration = "300s"
sql_memory_alert_duration = "180s"
sql_disk_utilization_alert_duration = "180s"
sql_disk_quota_alert_duration = "120s"
sql_memory_quota_alert_duration = "120s"
sql_postgres_connections_alert_duration = "120s"
sql_instance_state_alert_duration = "60s"
sql_replica_lag_alert_duration = "120s"
}
}
variable "alert_thresholds" {
type = object({
#sql_uptime_threshold = number
sql_server_up_threshold = number
sql_cpu_threshold = number
sql_memory_threshold = number
sql_disk_utilization_threshold = number
sql_disk_quota_threshold = number
sql_memory_quota_threshold = number
sql_postgres_connections_threshold = number
sql_instance_state_threshold = number
sql_replica_lag_threshold = number
})
description = "Threshold values for all alerts"
default = {
#sql_uptime_threshold = 60
sql_server_up_threshold = 1
sql_cpu_threshold = 0.9
sql_memory_threshold = 0.9
sql_disk_utilization_threshold = 0.8
sql_disk_quota_threshold = 10
sql_memory_quota_threshold = 10
sql_postgres_connections_threshold = 2000
sql_instance_state_threshold = 1
sql_replica_lag_threshold = 5 #A negative value indicates that replication is inactive.
}
}
variable "alert_config" {
type = object({
uptime = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
server_up = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
cpu = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
memory = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
disk_utilization = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
disk_quota = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
memory_quota = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
postgres_connections = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
instance_state = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
replica_lag = object({
filter = string
threshold = number
comparison = string
duration = string
alignment_period = string
per_series_aligner = string
})
})
description = "Configurations for alert durations and thresholds"
default = {
uptime = {
filter = "metric.type=\"cloudsql.googleapis.com/database/uptime\" resource.type=\"cloudsql_database\" "
threshold = 60
comparison = "COMPARISON_LT"
duration = "120s"
alignment_period = "60s"
per_series_aligner = "ALIGN_MAX"
}
server_up = {
filter = "metric.type=\"cloudsql.googleapis.com/database/up\" resource.type=\"cloudsql_database\" "
threshold = 1
comparison = "COMPARISON_LT"
duration = "60s"
alignment_period = "60s"
per_series_aligner = "ALIGN_SUM"
}
cpu = {
filter = "metric.type=\"cloudsql.googleapis.com/database/cpu/utilization\" resource.type=\"cloudsql_database\" "
threshold = 0.9
comparison = "COMPARISON_GT"
duration = "300s"
alignment_period = "60s"
per_series_aligner = "ALIGN_MAX"
}
memory = {
filter = "metric.type=\"cloudsql.googleapis.com/database/memory/utilization\" resource.type=\"cloudsql_database\" "
threshold = 0.9
comparison = "COMPARISON_GT"
duration = "180s"
alignment_period = "60s"
per_series_aligner = "ALIGN_MAX"
}
disk_utilization = {
filter = "metric.type=\"cloudsql.googleapis.com/database/disk/utilization\" resource.type=\"cloudsql_database\" "
threshold = 0.8
comparison = "COMPARISON_GT"
duration = "180s"
alignment_period = "60s"
per_series_aligner = "ALIGN_MAX"
}
disk_quota = {
filter = "metric.type=\"cloudsql.googleapis.com/database/disk/quota\" resource.type=\"cloudsql_database\" "
threshold = 10
comparison = "COMPARISON_GT"
duration = "120s"
alignment_period = "60s"
per_series_aligner = "ALIGN_MAX"
}
memory_quota = {
filter = "metric.type=\"cloudsql.googleapis.com/database/memory/quota\" resource.type=\"cloudsql_database\" "
threshold = 10
comparison = "COMPARISON_GT"
duration = "120s"
alignment_period = "60s"
per_series_aligner = "ALIGN_MAX"
}
postgres_connections = {
filter = "metric.type=\"cloudsql.googleapis.com/database/postgresql/num_backends\" resource.type=\"cloudsql_database\" "
threshold = 2000
comparison = "COMPARISON_GT"
duration = "120s"
alignment_period = "60s"
per_series_aligner = "ALIGN_MAX"
}
instance_state = {
filter = "metric.type=\"cloudsql.googleapis.com/database/instance_state\" resource.type=\"cloudsql_database\" "
threshold = 1
comparison = "COMPARISON_LT"
duration = "60s"
alignment_period = "60s"
per_series_aligner = "ALIGN_FRACTION_TRUE"
}
replica_lag = {
filter = "metric.type=\"cloudsql.googleapis.com/database/replication/replica_lag\" resource.type=\"cloudsql_database\" "
threshold = 5 #A negative value indicates that replication is inactive.
comparison = "COMPARISON_GT"
duration = "120s"
alignment_period = "60s"
per_series_aligner = "ALIGN_MEAN"
}
}
}