@@ -2,23 +2,14 @@ locals {
22 region_filter = " one_of(${ join (" , " , formatlist (" %q" , var. regions ))} )"
33}
44
5- resource "google_monitoring_service " "this" {
5+ resource "google_monitoring_custom_service " "this" {
66 service_id = " ${ lower (var. service_type )} -${ lower (var. service_name )} "
77 project = var. project_id
8-
9- basic_service {
10- service_type = var. service_type
11- service_labels = {
12- service_name = var.service_name
13- }
14- }
158}
169
1710# SLO with availability SLI across all regions
1811resource "google_monitoring_slo" "availability" {
19- count = var. slo . availability != null ? 1 : 0
20-
21- service = google_monitoring_service. this . service_id
12+ service = google_monitoring_custom_service. this . service_id
2213 slo_id = " ${ var . service_name } -availability-multi-region"
2314 display_name = " ${ var . service_name } - Multi-region Availability SLO"
2415 project = var. project_id
@@ -34,7 +25,7 @@ resource "google_monitoring_slo" "availability" {
3425resource "google_monitoring_slo" "availability_per_region" {
3526 for_each = var. slo . availability != null ? toset (var. regions ) : []
3627
37- service = google_monitoring_service . this . service_id
28+ service = google_monitoring_custom_service . this . service_id
3829 slo_id = " ${ var . service_name } -availability-${ each . value } "
3930 display_name = " ${ var . service_name } - ${ each . value } Availability SLO"
4031 project = var. project_id
@@ -60,7 +51,7 @@ resource "google_monitoring_alert_policy" "slo_burn_rate_multi_region" {
6051
6152 condition_threshold {
6253 filter = <<- EOT
63- select_slo_burn_rate("${ google_monitoring_slo . availability [ 0 ] . id } ", 3600)
54+ select_slo_burn_rate("${ google_monitoring_slo . availability . id } ", 3600)
6455 EOT
6556
6657 duration = " 0s"
0 commit comments