Skip to content

Commit d66c61d

Browse files
committed
allow disabling creation of alertmanager definition
1 parent d98ed59 commit d66c61d

4 files changed

Lines changed: 20 additions & 6 deletions

File tree

aws/telemetry/main.tf

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,13 @@ module "sns_topics" {
1818
module "prometheus_workspace" {
1919
source = "./modules/prometheus-workspace"
2020

21-
alert_group_by = var.alert_group_by
22-
alert_message_template = var.alert_message_template
23-
alert_resolve_timeout = var.alert_resolve_timeout
24-
alert_subject_template = var.alert_subject_template
25-
name = var.prometheus_workspace_name
26-
tags = var.tags
21+
alert_group_by = var.alert_group_by
22+
alert_message_template = var.alert_message_template
23+
alert_resolve_timeout = var.alert_resolve_timeout
24+
alert_subject_template = var.alert_subject_template
25+
alertmanager_config_enabled = var.alertmanager_config_enabled
26+
name = var.prometheus_workspace_name
27+
tags = var.tags
2728

2829
sns_receivers = merge({
2930
default = module.sns_topics.arns["alertmanager-${var.alert_default_severity}${var.sns_topic_name_suffix}"]

aws/telemetry/modules/prometheus-workspace/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ data "aws_iam_policy_document" "ingestion_assume_role" {
5151
}
5252

5353
resource "aws_prometheus_alert_manager_definition" "this" {
54+
count = var.alertmanager_config_enabled ? 1 : 0
5455
definition = yamlencode(local.alert_manager_definition)
5556
workspace_id = aws_prometheus_workspace.this.id
5657
}

aws/telemetry/modules/prometheus-workspace/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ variable "alert_subject_template" {
2222
default = null
2323
}
2424

25+
variable "alertmanager_config_enabled" {
26+
description = "Enable alertmanager configs for the Prometheus workspace"
27+
type = bool
28+
default = true
29+
}
30+
2531
variable "name" {
2632
description = "Name for this Prometheus workspace"
2733
type = string

aws/telemetry/variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ variable "alert_default_severity" {
4040
default = "warning"
4141
}
4242

43+
variable "alertmanager_config_enabled" {
44+
description = "Enable alertmanager configs for the Prometheus workspace"
45+
type = bool
46+
default = true
47+
}
48+
4349
variable "grafana_role_name" {
4450
description = "Name of the IAM role created for Grafana"
4551
type = string

0 commit comments

Comments
 (0)