Skip to content

Commit

Permalink
support multiple channels for each type
Browse files Browse the repository at this point in the history
Signed-off-by: Kenny Leung <[email protected]>
  • Loading branch information
k4leung4 committed Dec 11, 2024
1 parent a371f86 commit f0e6da4
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
8 changes: 4 additions & 4 deletions modules/alerting/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ No modules.
| <a name="input_failure_rate_exclude_services"></a> [failure\_rate\_exclude\_services](#input\_failure\_rate\_exclude\_services) | List of service names to exclude from the 5xx failure rate alert | `list(string)` | `[]` | no |
| <a name="input_failure_rate_ratio_threshold"></a> [failure\_rate\_ratio\_threshold](#input\_failure\_rate\_ratio\_threshold) | ratio threshold to alert for cloud run server failure rate. | `number` | `0.2` | no |
| <a name="input_global_only_alerts"></a> [global\_only\_alerts](#input\_global\_only\_alerts) | only enable global alerts. when true, only create alerts that are global. | `bool` | `false` | no |
| <a name="input_notification_channel_email"></a> [notification\_channel\_email](#input\_notification\_channel\_email) | Email notification channel. | `string` | `""` | no |
| <a name="input_notification_channel_pagerduty"></a> [notification\_channel\_pagerduty](#input\_notification\_channel\_pagerduty) | Email notification channel. | `string` | `""` | no |
| <a name="input_notification_channel_pubsub"></a> [notification\_channel\_pubsub](#input\_notification\_channel\_pubsub) | Pubsub notification channel. | `string` | `""` | no |
| <a name="input_notification_channel_slack"></a> [notification\_channel\_slack](#input\_notification\_channel\_slack) | Slack notification channel. | `string` | `""` | no |
| <a name="input_notification_channels"></a> [notification\_channels](#input\_notification\_channels) | List of notification channels to alert. | `list(string)` | `[]` | no |
| <a name="input_notification_channels_email"></a> [notification\_channels\_email](#input\_notification\_channels\_email) | Email notification channel. | `list(string)` | `[]` | no |
| <a name="input_notification_channels_pagerduty"></a> [notification\_channels\_pagerduty](#input\_notification\_channels\_pagerduty) | Email notification channel. | `list(string)` | `[]` | no |
| <a name="input_notification_channels_pubsub"></a> [notification\_channels\_pubsub](#input\_notification\_channels\_pubsub) | Pubsub notification channel. | `list(string)` | `[]` | no |
| <a name="input_notification_channels_slack"></a> [notification\_channels\_slack](#input\_notification\_channels\_slack) | Slack notification channel. | `list(string)` | `[]` | no |
| <a name="input_oom_filter"></a> [oom\_filter](#input\_oom\_filter) | additional filter to apply to oom alert policy | `string` | `""` | no |
| <a name="input_panic_filter"></a> [panic\_filter](#input\_panic\_filter) | additional filter to apply to panic alert policy | `string` | `""` | no |
| <a name="input_project_id"></a> [project\_id](#input\_project\_id) | n/a | `string` | n/a | yes |
Expand Down
22 changes: 11 additions & 11 deletions modules/alerting/main.tf
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
locals {
oncall = [
var.notification_channel_pagerduty,
var.notification_channel_email,
var.notification_channel_pubsub
]

slack = [
var.notification_channel_slack,
var.notification_channel_email,
var.notification_channel_pubsub
]
oncall = concat(
var.notification_channels_pagerduty,
var.notification_channels_email,
var.notification_channels_pubsub
)

slack = concat(
var.notification_channels_slack,
var.notification_channels_email,
var.notification_channels_pubsub
)
}

locals {
Expand Down
24 changes: 12 additions & 12 deletions modules/alerting/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,28 @@ variable "notification_channels" {
default = []
}

variable "notification_channel_pagerduty" {
variable "notification_channels_pagerduty" {
description = "Email notification channel."
type = string
default = ""
type = list(string)
default = []
}

variable "notification_channel_slack" {
variable "notification_channels_slack" {
description = "Slack notification channel."
type = string
default = ""
type = list(string)
default = []
}

variable "notification_channel_email" {
variable "notification_channels_email" {
description = "Email notification channel."
type = string
default = ""
type = list(string)
default = []
}

variable "notification_channel_pubsub" {
variable "notification_channels_pubsub" {
description = "Pubsub notification channel."
type = string
default = ""
type = list(string)
default = []
}

variable "oom_filter" {
Expand Down

0 comments on commit f0e6da4

Please sign in to comment.