-
Notifications
You must be signed in to change notification settings - Fork 1
/
monitoring.tf
60 lines (46 loc) · 1.85 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
59
60
resource "google_project_iam_binding" "monitoring_viewer_sre" {
project = var.gcp_project_id
role = "roles/monitoring.viewer"
members = [var.sre_iam_uri]
}
resource "google_project_iam_binding" "dashboard_viewer_sre" {
project = var.gcp_project_id
role = "roles/monitoring.dashboardViewer"
members = [var.sre_iam_uri]
}
resource "google_monitoring_group" "main" {
display_name = "gateway"
filter = "resource.metadata.tag.environment=\"${var.instance_name}\""
depends_on = [google_project_service.services]
}
resource "google_monitoring_notification_channel" "sres_email" {
for_each = toset(var.alert_email_addresses)
display_name = "Notify SREs (managed by Terraform workspace ${terraform.workspace})"
type = "email"
labels = {
email_address = each.value
}
depends_on = [google_project_service.services]
}
module "poweb_lb_uptime" {
source = "../host_uptime_monitor"
name = "gateway-${var.instance_name}-poweb"
host_name = google_dns_record_set.poweb.name
notification_channels = [for c in google_monitoring_notification_channel.sres_email : c.name]
gcp_project_id = var.gcp_project_id
}
module "pohttp_lb_uptime" {
source = "../host_uptime_monitor"
name = "gateway-${var.instance_name}-pohttp"
host_name = google_dns_record_set.pohttp.name
notification_channels = [for c in google_monitoring_notification_channel.sres_email : c.name]
gcp_project_id = var.gcp_project_id
}
module "cogrpc_lb_uptime" {
source = "../host_uptime_monitor"
name = "gateway-${var.instance_name}-cogrpc"
probe_type = "tcp"
host_name = google_dns_record_set.cogrpc.name
notification_channels = [for c in google_monitoring_notification_channel.sres_email : c.name]
gcp_project_id = var.gcp_project_id
}