Skip to content

Commit

Permalink
Allow creating alerts with multiple notification channels
Browse files Browse the repository at this point in the history
Signed-off-by: Priya Wadhwa <priya@chainguard.dev>
  • Loading branch information
priyawadhwa committed Jul 21, 2022
1 parent baa0418 commit 4e358a1
Show file tree
Hide file tree
Showing 7 changed files with 41 additions and 41 deletions.
8 changes: 4 additions & 4 deletions terraform/gcp/modules/monitoring/dex/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ variable "dex_url" {
}

// Set-up for notification channel for alerting
variable "notification_channel_id" {
type = string
description = "The notification channel ID which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
variable "notification_channel_ids" {
type = list(string)
description = "List of notification channel IDs which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
}

locals {
notification_channels = [format("projects/%v/notificationChannels/%v", var.project_id, var.notification_channel_id)]
notification_channels = toset([for nc in var.notification_channel_ids : format("projects/%v/notificationChannels/%v", var.project_id, nc)])
}
8 changes: 4 additions & 4 deletions terraform/gcp/modules/monitoring/fulcio/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ variable "ctlog_url" {
}

// Set-up for notification channel for alerting
variable "notification_channel_id" {
type = string
description = "The notification channel ID which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
variable "notification_channel_ids" {
type = list(string)
description = "List of notification channel IDs which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
}

locals {
notification_channels = [format("projects/%v/notificationChannels/%v", var.project_id, var.notification_channel_id)]
notification_channels = toset([for nc in var.notification_channel_ids : format("projects/%v/notificationChannels/%v", var.project_id, nc)])
hosts = [var.fulcio_url, var.ctlog_url]
}

Expand Down
8 changes: 4 additions & 4 deletions terraform/gcp/modules/monitoring/infra/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ variable "fulcio_url" {
}

// Set-up for notification channel for alerting
variable "notification_channel_id" {
type = string
description = "The notification channel ID which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
variable "notification_channel_ids" {
type = list(string)
description = "List of notification channel IDs which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
}

locals {
notification_channels = [format("projects/%v/notificationChannels/%v", var.project_id, var.notification_channel_id)]
notification_channels = toset([for nc in var.notification_channel_ids : format("projects/%v/notificationChannels/%v", var.project_id, nc)])
}
8 changes: 4 additions & 4 deletions terraform/gcp/modules/monitoring/prober/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ variable "fulcio_url" {
}

// Set-up for notification channel for alerting
variable "notification_channel_id" {
type = string
description = "The notification channel ID which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
variable "notification_channel_ids" {
type = list(string)
description = "List of notification channel IDs which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
}

locals {
notification_channels = [format("projects/%v/notificationChannels/%v", var.project_id, var.notification_channel_id)]
notification_channels = toset([for nc in var.notification_channel_ids : format("projects/%v/notificationChannels/%v", var.project_id, nc)])
hosts = [var.rekor_url, var.fulcio_url]
}
8 changes: 4 additions & 4 deletions terraform/gcp/modules/monitoring/rekor/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ variable "rekor_url" {
}

// Set-up for notification channel for alerting
variable "notification_channel_id" {
type = string
description = "The notification channel ID which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
variable "notification_channel_ids" {
type = list(string)
description = "List of notification channel IDs which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
}

variable "api_endpoints_get" {
Expand All @@ -46,6 +46,6 @@ variable "api_endpoints_get" {
}

locals {
notification_channels = [format("projects/%v/notificationChannels/%v", var.project_id, var.notification_channel_id)]
notification_channels = toset([for nc in var.notification_channel_ids : format("projects/%v/notificationChannels/%v", var.project_id, nc)])
}

34 changes: 17 additions & 17 deletions terraform/gcp/modules/monitoring/sigstore.tf
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ resource "google_project_service" "service" {
module "rekor" {
source = "./rekor"

project_id = var.project_id
notification_channel_id = var.notification_channel_id
rekor_url = var.rekor_url
project_id = var.project_id
notification_channel_ids = var.notification_channel_ids
rekor_url = var.rekor_url

depends_on = [
google_project_service.service
Expand All @@ -47,10 +47,10 @@ module "rekor" {
module "fulcio" {
source = "./fulcio"

project_id = var.project_id
notification_channel_id = var.notification_channel_id
ctlog_url = var.ctlog_url
fulcio_url = var.fulcio_url
project_id = var.project_id
notification_channel_ids = var.notification_channel_ids
ctlog_url = var.ctlog_url
fulcio_url = var.fulcio_url

depends_on = [
google_project_service.service
Expand All @@ -61,8 +61,8 @@ module "fulcio" {
module "dex" {
source = "./dex"

project_id = var.project_id
notification_channel_id = var.notification_channel_id
project_id = var.project_id
notification_channel_ids = var.notification_channel_ids

dex_url = var.dex_url

Expand All @@ -75,10 +75,10 @@ module "dex" {
module "prober" {
source = "./prober"

project_id = var.project_id
notification_channel_id = var.notification_channel_id
rekor_url = var.prober_rekor_url
fulcio_url = var.prober_fulcio_url
project_id = var.project_id
notification_channel_ids = var.notification_channel_ids
rekor_url = var.prober_rekor_url
fulcio_url = var.prober_fulcio_url

depends_on = [
google_project_service.service
Expand All @@ -88,10 +88,10 @@ module "prober" {
module "infra" {
source = "./infra"

project_id = var.project_id
notification_channel_id = var.notification_channel_id
rekor_url = local.qualified_rekor_url
fulcio_url = local.qualified_fulcio_url
project_id = var.project_id
notification_channel_ids = var.notification_channel_ids
rekor_url = local.qualified_rekor_url
fulcio_url = local.qualified_fulcio_url

depends_on = [
google_project_service.service
Expand Down
8 changes: 4 additions & 4 deletions terraform/gcp/modules/monitoring/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -69,13 +69,13 @@ variable "prober_fulcio_url" {
}

// Set-up for notification channel for alerting
variable "notification_channel_id" {
type = string
description = "The notification channel ID which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
variable "notification_channel_ids" {
type = list(string)
description = "List of notification channel IDs which alerts should be sent to. You can find this by running `gcloud alpha monitoring channels list`."
}

locals {
notification_channels = [format("projects/%v/notificationChannels/%v", var.project_id, var.notification_channel_id)]
notification_channels = toset([for nc in var.notification_channel_ids : format("projects/%v/notificationChannels/%v", var.project_id, nc)])
qualified_rekor_url = format("https://%s", var.rekor_url)
qualified_fulcio_url = format("https://%s", var.fulcio_url)
}
Expand Down

0 comments on commit 4e358a1

Please sign in to comment.