diff --git a/README.md b/README.md index ebedc25..ec62cbe 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: @@ -83,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 | 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