From 72aca475060acd7e9fb1b6db79f36a769859f7ba Mon Sep 17 00:00:00 2001 From: FlawlessByte Date: Thu, 4 Sep 2025 01:21:03 +0100 Subject: [PATCH 1/2] feat: add option to disable alertmanager creation --- README.md | 1 + examples/complete/main.tf | 1 + main.tf | 2 +- variables.tf | 6 ++++++ 4 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index ebedc25..9143caf 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ module "prometheus" { workspace_alias = "example" + create_alert_manager = true alert_manager_definition = <<-EOT alertmanager_config: | route: diff --git a/examples/complete/main.tf b/examples/complete/main.tf index 4cee2f1..c4a794d 100644 --- a/examples/complete/main.tf +++ b/examples/complete/main.tf @@ -19,6 +19,7 @@ module "prometheus" { log_group_arn = "${aws_cloudwatch_log_group.this.arn}:*" } + create_alert_manager = true alert_manager_definition = <<-EOT alertmanager_config: | route: diff --git a/main.tf b/main.tf index d5fd5f9..f4c2a69 100644 --- a/main.tf +++ b/main.tf @@ -28,7 +28,7 @@ resource "aws_prometheus_workspace" "this" { ################################################################################ resource "aws_prometheus_alert_manager_definition" "this" { - count = var.create ? 1 : 0 + count = var.create && var.create_alert_manager ? 1 : 0 workspace_id = local.workspace_id definition = var.alert_manager_definition diff --git a/variables.tf b/variables.tf index 3448269..57420fd 100644 --- a/variables.tf +++ b/variables.tf @@ -48,6 +48,12 @@ variable "kms_key_arn" { # Alert Manager Definition ################################################################################ +variable "create_alert_manager" { + description = "Controls whether an Alert Manager definition is created along with the AMP workspace" + type = bool + default = true +} + variable "alert_manager_definition" { description = "The alert manager definition that you want to be applied. See more in the [AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html)" type = string From c9ed57f2d37021fb6361ae31502ef41d38fab686 Mon Sep 17 00:00:00 2001 From: FlawlessByte Date: Thu, 4 Sep 2025 01:30:05 +0100 Subject: [PATCH 2/2] docs: auto-generate documentation for create_alert_manager variable --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9143caf..ec62cbe 100644 --- a/README.md +++ b/README.md @@ -84,6 +84,7 @@ No modules. |------|-------------|------|---------|:--------:| | [alert\_manager\_definition](#input\_alert\_manager\_definition) | The alert manager definition that you want to be applied. See more in the [AWS Docs](https://docs.aws.amazon.com/prometheus/latest/userguide/AMP-alert-manager.html) | `string` | `"alertmanager_config: |\n route:\n receiver: 'default'\n receivers:\n - name: 'default'\n"` | no | | [create](#input\_create) | Determines whether a resources will be created | `bool` | `true` | no | +| [create\_alert\_manager](#input\_create\_alert\_manager) | Controls whether an Alert Manager definition is created along with the AMP workspace | `bool` | `true` | no | | [create\_workspace](#input\_create\_workspace) | Determines whether a workspace will be created or to use an existing workspace | `bool` | `true` | no | | [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN of the KMS Key to for encryption at rest | `string` | `null` | no | | [logging\_configuration](#input\_logging\_configuration) | The logging configuration of the prometheus workspace. | `map(string)` | `{}` | no |