diff --git a/cloud/aws/elasticache/common/inputs.tf b/cloud/aws/elasticache/common/inputs.tf index df0e2f3..12354d7 100644 --- a/cloud/aws/elasticache/common/inputs.tf +++ b/cloud/aws/elasticache/common/inputs.tf @@ -35,6 +35,11 @@ variable "eviction_silenced" { type = "map" } +variable "eviction_enabled" { + description = "Flag to enable Elasticache eviction monitor" + type = "string" + default = "true" +} variable "eviction_extra_tags" { description = "Extra tags for Elasticache eviction monitor" type = "list" @@ -60,6 +65,11 @@ variable "max_connection_silenced" { type = "map" } +variable "max_connection_enabled" { + description = "Flag to enable Elasticache max connection monitor" + type = "string" + default = "true" +} variable "max_connection_extra_tags" { description = "Extra tags for Elasticache max connection monitor" type = "list" @@ -85,6 +95,11 @@ variable "no_connection_silenced" { type = "map" } +variable "no_connection_enabled" { + description = "Flag to enable Elasticache no connection monitor" + type = "string" + default = "true" +} variable "no_connection_extra_tags" { description = "Extra tags for Elasticache no connection monitor" type = "list" @@ -110,6 +125,11 @@ variable "swap_silenced" { type = "map" } +variable "swap_enabled" { + description = "Flag to enable Elasticache swap monitor" + type = "string" + default = "true" +} variable "swap_extra_tags" { description = "Extra tags for Elasticache swap monitor" type = "list" @@ -143,6 +163,11 @@ variable "free_memory_silenced" { type = "map" } +variable "free_memory_enabled" { + description = "Flag to enable Elasticache free memory monitor" + type = "string" + default = "true" +} variable "free_memory_extra_tags" { description = "Extra tags for Elasticache free memory monitor" type = "list" @@ -175,6 +200,11 @@ variable "eviction_growing_silenced" { type = "map" } +variable "eviction_growing_enabled" { + description = "Flag to enable Elasticache eviction growing monitor" + type = "string" + default = "true" +} variable "eviction_growing_extra_tags" { description = "Extra tags for Elasticache eviction growing monitor" type = "list" diff --git a/cloud/aws/elasticache/common/monitors-elasticache.tf b/cloud/aws/elasticache/common/monitors-elasticache.tf index b315e81..f0191b8 100644 --- a/cloud/aws/elasticache/common/monitors-elasticache.tf +++ b/cloud/aws/elasticache/common/monitors-elasticache.tf @@ -1,4 +1,5 @@ resource "datadog_monitor" "elasticache_eviction" { +count = "${var.eviction_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache eviction {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}" message = "${coalesce(var.eviction_message, var.message)}" @@ -26,6 +27,7 @@ resource "datadog_monitor" "elasticache_eviction" { } resource "datadog_monitor" "elasticache_max_connection" { +count = "${var.max_connection_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache max connections reached {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" message = "${coalesce(var.max_connection_message, var.message)}" @@ -53,6 +55,7 @@ resource "datadog_monitor" "elasticache_max_connection" { } resource "datadog_monitor" "elasticache_no_connection" { +count = "${var.no_connection_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache connections {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" message = "${coalesce(var.no_connection_message, var.message)}" @@ -80,6 +83,7 @@ resource "datadog_monitor" "elasticache_no_connection" { } resource "datadog_monitor" "elasticache_swap" { +count = "${var.swap_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache swap {{#is_alert}}{{{comparator}}} {{threshold}}MB ({{value}}MB){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}MB ({{value}}MB){{/is_warning}}" message = "${coalesce(var.swap_message, var.message)}" @@ -113,6 +117,7 @@ resource "datadog_monitor" "elasticache_swap" { # POC - A approfondir resource "datadog_monitor" "elasticache_free_memory" { +count = "${var.free_memory_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache free memory {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.free_memory_message, var.message)}" @@ -145,6 +150,7 @@ resource "datadog_monitor" "elasticache_free_memory" { } resource "datadog_monitor" "elasticache_eviction_growing" { +count = "${var.eviction_growing_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache evictions is growing {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" message = "${coalesce(var.eviction_growing_message, var.message)}" diff --git a/cloud/aws/elasticache/memcached/inputs.tf b/cloud/aws/elasticache/memcached/inputs.tf index 728c7b3..be38c1e 100644 --- a/cloud/aws/elasticache/memcached/inputs.tf +++ b/cloud/aws/elasticache/memcached/inputs.tf @@ -35,6 +35,11 @@ variable "get_hits_silenced" { type = "map" default = {} } +variable "get_hits_enabled" { + description = "Flag to enable Elasticache memcached get hits monitor" + type = "string" + default = "true" +} variable "get_hits_extra_tags" { description = "Extra tags for Elasticache memcached get hits monitor" @@ -68,6 +73,11 @@ variable "cpu_high_silenced" { type = "map" default = {} } +variable "cpu_high_enabled" { + description = "Flag to enable Elasticache memcached cpu high monitor" + type = "string" + default = "true" +} variable "cpu_high_extra_tags" { description = "Extra tags for Elasticache memcached cpu high monitor" @@ -108,6 +118,11 @@ variable "eviction_silenced" { type = "map" default = {} } +variable "eviction_enabled" { + description = "Flag to enable Elasticache eviction monitor" + type = "string" + default = "true" +} variable "eviction_message" { description = "Custom message for Elasticache eviction monitor" @@ -131,6 +146,11 @@ variable "max_connection_silenced" { type = "map" default = {} } +variable "max_connection_enabled" { + description = "Flag to enable Elasticache max connection monitor" + type = "string" + default = "true" +} variable "max_connection_message" { description = "Custom message for Elasticache max connection monitor" @@ -154,6 +174,11 @@ variable "no_connection_silenced" { type = "map" default = {} } +variable "no_connection_enabled" { + description = "Flag to enable Elasticache no connection monitor" + type = "string" + default = "true" +} variable "no_connection_message" { description = "Custom message for Elasticache no connection monitor" @@ -177,6 +202,11 @@ variable "swap_silenced" { type = "map" default = {} } +variable "swap_enabled" { + description = "Flag to enable Elasticache swap monitor" + type = "string" + default = "true" +} variable "swap_message" { description = "Custom message for Elasticache swap monitor" @@ -210,6 +240,11 @@ variable "free_memory_silenced" { type = "map" default = {} } +variable "free_memory_enabled" { + description = "Flag to enable Elasticache free memory monitor" + type = "string" + default = "true" +} variable "free_memory_message" { description = "Custom message for Elasticache free memory monitor" @@ -242,6 +277,11 @@ variable "eviction_growing_silenced" { type = "map" default = {} } +variable "eviction_growing_enabled" { + description = "Flag to enable Elasticache eviction growing monitor" + type = "string" + default = "true" +} variable "eviction_growing_message" { description = "Custom message for Elasticache eviction growing monitor" diff --git a/cloud/aws/elasticache/memcached/monitors-memcached.tf b/cloud/aws/elasticache/memcached/monitors-memcached.tf index 74ecedf..e274c90 100644 --- a/cloud/aws/elasticache/memcached/monitors-memcached.tf +++ b/cloud/aws/elasticache/memcached/monitors-memcached.tf @@ -54,6 +54,7 @@ module "datadog-monitors-aws-elasticache-common" { } resource "datadog_monitor" "memcached_get_hits" { +count = "${var.get_hits_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache memcached get hits {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.get_hits_message, var.message)}" @@ -88,6 +89,7 @@ resource "datadog_monitor" "memcached_get_hits" { } resource "datadog_monitor" "memcached_cpu_high" { +count = "${var.cpu_high_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache memcached CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.cpu_high_message, var.message)}" diff --git a/cloud/aws/elasticache/redis/inputs.tf b/cloud/aws/elasticache/redis/inputs.tf index 262d39f..de2f1b5 100644 --- a/cloud/aws/elasticache/redis/inputs.tf +++ b/cloud/aws/elasticache/redis/inputs.tf @@ -35,6 +35,11 @@ variable "cache_hits_silenced" { type = "map" default = {} } +variable "cache_hits_enabled" { + description = "Flag to enable Elasticache redis cache hits monitor" + type = "string" + default = "true" +} variable "cache_hits_extra_tags" { description = "Extra tags for Elasticache redis cache hits monitor" @@ -68,6 +73,11 @@ variable "cpu_high_silenced" { type = "map" default = {} } +variable "cpu_high_enabled" { + description = "Flag to enable Elasticache redis cpu high monitor" + type = "string" + default = "true" +} variable "cpu_high_extra_tags" { description = "Extra tags for Elasticache redis cpu high monitor" @@ -107,6 +117,11 @@ variable "replication_lag_silenced" { type = "map" default = {} } +variable "replication_lag_enabled" { + description = "Flag to enable Elasticache redis replication lag monitor" + type = "string" + default = "true" +} variable "replication_lag_extra_tags" { description = "Extra tags for Elasticache redis replication lag monitor" @@ -146,6 +161,11 @@ variable "commands_silenced" { type = "map" default = {} } +variable "commands_enabled" { + description = "Flag to enable Elasticache redis commands monitor" + type = "string" + default = "true" +} variable "commands_extra_tags" { description = "Extra tags for Elasticache redis commands monitor" @@ -170,6 +190,11 @@ variable "eviction_silenced" { type = "map" default = {} } +variable "eviction_enabled" { + description = "Flag to enable Elasticache eviction monitor" + type = "string" + default = "true" +} variable "eviction_message" { description = "Custom message for Elasticache eviction monitor" @@ -193,6 +218,11 @@ variable "max_connection_silenced" { type = "map" default = {} } +variable "max_connection_enabled" { + description = "Flag to enable Elasticache max connection monitor" + type = "string" + default = "true" +} variable "max_connection_message" { description = "Custom message for Elasticache max connection monitor" @@ -216,6 +246,11 @@ variable "no_connection_silenced" { type = "map" default = {} } +variable "no_connection_enabled" { + description = "Flag to enable Elasticache no connection monitor" + type = "string" + default = "true" +} variable "no_connection_message" { description = "Custom message for Elasticache no connection monitor" @@ -239,6 +274,11 @@ variable "swap_silenced" { type = "map" default = {} } +variable "swap_enabled" { + description = "Flag to enable Elasticache swap monitor" + type = "string" + default = "true" +} variable "swap_message" { description = "Custom message for Elasticache swap monitor" @@ -272,6 +312,11 @@ variable "free_memory_silenced" { type = "map" default = {} } +variable "free_memory_enabled" { + description = "Flag to enable Elasticache free memory monitor" + type = "string" + default = "true" +} variable "free_memory_message" { description = "Custom message for Elasticache free memory monitor" @@ -304,6 +349,11 @@ variable "eviction_growing_silenced" { type = "map" default = {} } +variable "eviction_growing_enabled" { + description = "Flag to enable Elasticache eviction growing monitor" + type = "string" + default = "true" +} variable "eviction_growing_message" { description = "Custom message for Elasticache eviction growing monitor" diff --git a/cloud/aws/elasticache/redis/monitors-redis.tf b/cloud/aws/elasticache/redis/monitors-redis.tf index bb4991a..e23d178 100644 --- a/cloud/aws/elasticache/redis/monitors-redis.tf +++ b/cloud/aws/elasticache/redis/monitors-redis.tf @@ -54,6 +54,7 @@ module "datadog-monitors-aws-elasticache-common" { } resource "datadog_monitor" "redis_cache_hits" { +count = "${var.cache_hits_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache redis cache hits {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.cache_hits_message, var.message)}" @@ -88,6 +89,7 @@ resource "datadog_monitor" "redis_cache_hits" { } resource "datadog_monitor" "redis_cpu_high" { +count = "${var.cpu_high_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache redis CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = "${coalesce(var.cpu_high_message, var.message)}" @@ -115,6 +117,7 @@ resource "datadog_monitor" "redis_cpu_high" { } resource "datadog_monitor" "redis_replication_lag" { +count = "${var.replication_lag_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache redis replication lag {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" message = "${coalesce(var.replication_lag_message, var.message)}" @@ -147,6 +150,7 @@ resource "datadog_monitor" "redis_replication_lag" { } resource "datadog_monitor" "redis_commands" { +count = "${var.commands_enabled ? 1 : 0}" name = "[${var.environment}] Elasticache redis is receiving no commands" message = "${coalesce(var.commands_message, var.message)}"