Skip to content

Commit c838818

Browse files
authored
feat: Add the capability to disable alert manager creation (#20)
1 parent 69d8d68 commit c838818

File tree

4 files changed

+10
-1
lines changed

4 files changed

+10
-1
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ module "prometheus" {
1212
1313
workspace_alias = "example"
1414
15+
create_alert_manager = true
1516
alert_manager_definition = <<-EOT
1617
alertmanager_config: |
1718
route:
@@ -83,6 +84,7 @@ No modules.
8384
|------|-------------|------|---------|:--------:|
8485
| <a name="input_alert_manager_definition"></a> [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 |
8586
| <a name="input_create"></a> [create](#input\_create) | Determines whether a resources will be created | `bool` | `true` | no |
87+
| <a name="input_create_alert_manager"></a> [create\_alert\_manager](#input\_create\_alert\_manager) | Controls whether an Alert Manager definition is created along with the AMP workspace | `bool` | `true` | no |
8688
| <a name="input_create_workspace"></a> [create\_workspace](#input\_create\_workspace) | Determines whether a workspace will be created or to use an existing workspace | `bool` | `true` | no |
8789
| <a name="input_kms_key_arn"></a> [kms\_key\_arn](#input\_kms\_key\_arn) | The ARN of the KMS Key to for encryption at rest | `string` | `null` | no |
8890
| <a name="input_logging_configuration"></a> [logging\_configuration](#input\_logging\_configuration) | The logging configuration of the prometheus workspace. | `map(string)` | `{}` | no |

examples/complete/main.tf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ module "prometheus" {
1919
log_group_arn = "${aws_cloudwatch_log_group.this.arn}:*"
2020
}
2121

22+
create_alert_manager = true
2223
alert_manager_definition = <<-EOT
2324
alertmanager_config: |
2425
route:

main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ resource "aws_prometheus_workspace" "this" {
2828
################################################################################
2929

3030
resource "aws_prometheus_alert_manager_definition" "this" {
31-
count = var.create ? 1 : 0
31+
count = var.create && var.create_alert_manager ? 1 : 0
3232

3333
workspace_id = local.workspace_id
3434
definition = var.alert_manager_definition

variables.tf

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,12 @@ variable "kms_key_arn" {
4848
# Alert Manager Definition
4949
################################################################################
5050

51+
variable "create_alert_manager" {
52+
description = "Controls whether an Alert Manager definition is created along with the AMP workspace"
53+
type = bool
54+
default = true
55+
}
56+
5157
variable "alert_manager_definition" {
5258
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)"
5359
type = string

0 commit comments

Comments
 (0)