From 22d1cbc4ae3249d176d981f077c03d0c49525e49 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 19 Sep 2018 19:24:32 +0200 Subject: [PATCH] MON-32 update tag convention and add extra tags --- cloud/aws/elasticache/common/inputs.tf | 36 +++++++++++++++++++ .../common/monitors-elasticache.tf | 12 +++---- cloud/aws/elasticache/memcached/inputs.tf | 12 +++++++ .../memcached/monitors-memcached.tf | 4 +-- cloud/aws/elasticache/redis/inputs.tf | 24 +++++++++++++ cloud/aws/elasticache/redis/monitors-redis.tf | 8 ++--- 6 files changed, 84 insertions(+), 12 deletions(-) diff --git a/cloud/aws/elasticache/common/inputs.tf b/cloud/aws/elasticache/common/inputs.tf index b73bedb..df0e2f3 100644 --- a/cloud/aws/elasticache/common/inputs.tf +++ b/cloud/aws/elasticache/common/inputs.tf @@ -35,6 +35,12 @@ variable "eviction_silenced" { type = "map" } +variable "eviction_extra_tags" { + description = "Extra tags for Elasticache eviction monitor" + type = "list" + default = [] +} + variable "eviction_message" { description = "Custom message for Elasticache eviction monitor" type = "string" @@ -54,6 +60,12 @@ variable "max_connection_silenced" { type = "map" } +variable "max_connection_extra_tags" { + description = "Extra tags for Elasticache max connection monitor" + type = "list" + default = [] +} + variable "max_connection_message" { description = "Custom message for Elasticache max connection monitor" type = "string" @@ -73,6 +85,12 @@ variable "no_connection_silenced" { type = "map" } +variable "no_connection_extra_tags" { + description = "Extra tags for Elasticache no connection monitor" + type = "list" + default = [] +} + variable "no_connection_message" { description = "Custom message for Elasticache no connection monitor" type = "string" @@ -92,6 +110,12 @@ variable "swap_silenced" { type = "map" } +variable "swap_extra_tags" { + description = "Extra tags for Elasticache swap monitor" + type = "list" + default = [] +} + variable "swap_message" { description = "Custom message for Elasticache swap monitor" type = "string" @@ -119,6 +143,12 @@ variable "free_memory_silenced" { type = "map" } +variable "free_memory_extra_tags" { + description = "Extra tags for Elasticache free memory monitor" + type = "list" + default = [] +} + variable "free_memory_message" { description = "Custom message for Elasticache free memory monitor" type = "string" @@ -145,6 +175,12 @@ variable "eviction_growing_silenced" { type = "map" } +variable "eviction_growing_extra_tags" { + description = "Extra tags for Elasticache eviction growing monitor" + type = "list" + default = [] +} + variable "eviction_growing_message" { description = "Custom message for Elasticache eviction growing monitor" type = "string" diff --git a/cloud/aws/elasticache/common/monitors-elasticache.tf b/cloud/aws/elasticache/common/monitors-elasticache.tf index 4c28e08..b315e81 100644 --- a/cloud/aws/elasticache/common/monitors-elasticache.tf +++ b/cloud/aws/elasticache/common/monitors-elasticache.tf @@ -22,7 +22,7 @@ resource "datadog_monitor" "elasticache_eviction" { silenced = "${var.eviction_silenced}" - tags = ["env:${var.environment}", "engine:${var.resource}", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.eviction_extra_tags}"] } resource "datadog_monitor" "elasticache_max_connection" { @@ -49,7 +49,7 @@ resource "datadog_monitor" "elasticache_max_connection" { silenced = "${var.max_connection_silenced}" - tags = ["env:${var.environment}", "engine:${var.resource}", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.max_connection_extra_tags}"] } resource "datadog_monitor" "elasticache_no_connection" { @@ -76,7 +76,7 @@ resource "datadog_monitor" "elasticache_no_connection" { silenced = "${var.no_connection_silenced}" - tags = ["env:${var.environment}", "engine:${var.resource}", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.no_connection_extra_tags}"] } resource "datadog_monitor" "elasticache_swap" { @@ -108,7 +108,7 @@ resource "datadog_monitor" "elasticache_swap" { silenced = "${var.swap_silenced}" - tags = ["env:${var.environment}", "engine:${var.resource}", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.swap_extra_tags}"] } # POC - A approfondir @@ -141,7 +141,7 @@ resource "datadog_monitor" "elasticache_free_memory" { silenced = "${var.free_memory_silenced}" - tags = ["env:${var.environment}", "engine:${var.resource}", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.free_memory_extra_tags}"] } resource "datadog_monitor" "elasticache_eviction_growing" { @@ -173,5 +173,5 @@ resource "datadog_monitor" "elasticache_eviction_growing" { silenced = "${var.eviction_growing_silenced}" - tags = ["env:${var.environment}", "engine:${var.resource}", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.eviction_growing_extra_tags}"] } diff --git a/cloud/aws/elasticache/memcached/inputs.tf b/cloud/aws/elasticache/memcached/inputs.tf index 12d499f..728c7b3 100644 --- a/cloud/aws/elasticache/memcached/inputs.tf +++ b/cloud/aws/elasticache/memcached/inputs.tf @@ -36,6 +36,12 @@ variable "get_hits_silenced" { default = {} } +variable "get_hits_extra_tags" { + description = "Extra tags for Elasticache memcached get hits monitor" + type = "list" + default = [] +} + variable "get_hits_message" { description = "Custom message for Elasticache memcached get hits monitor" type = "string" @@ -63,6 +69,12 @@ variable "cpu_high_silenced" { default = {} } +variable "cpu_high_extra_tags" { + description = "Extra tags for Elasticache memcached cpu high monitor" + type = "list" + default = [] +} + variable "cpu_high_message" { description = "Custom message for Elasticache memcached cpu high monitor" type = "string" diff --git a/cloud/aws/elasticache/memcached/monitors-memcached.tf b/cloud/aws/elasticache/memcached/monitors-memcached.tf index 58484e1..74ecedf 100644 --- a/cloud/aws/elasticache/memcached/monitors-memcached.tf +++ b/cloud/aws/elasticache/memcached/monitors-memcached.tf @@ -84,7 +84,7 @@ resource "datadog_monitor" "memcached_get_hits" { silenced = "${var.get_hits_silenced}" - tags = ["env:${var.environment}", "engine:memcached", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "${var.get_hits_extra_tags}"] } resource "datadog_monitor" "memcached_cpu_high" { @@ -116,5 +116,5 @@ resource "datadog_monitor" "memcached_cpu_high" { silenced = "${var.cpu_high_silenced}" - tags = ["env:${var.environment}", "engine:memcached", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "${var.cpu_high_extra_tags}"] } diff --git a/cloud/aws/elasticache/redis/inputs.tf b/cloud/aws/elasticache/redis/inputs.tf index 09b4bbf..262d39f 100644 --- a/cloud/aws/elasticache/redis/inputs.tf +++ b/cloud/aws/elasticache/redis/inputs.tf @@ -36,6 +36,12 @@ variable "cache_hits_silenced" { default = {} } +variable "cache_hits_extra_tags" { + description = "Extra tags for Elasticache redis cache hits monitor" + type = "list" + default = [] +} + variable "cache_hits_message" { description = "Custom message for Elasticache redis cache hits monitor" type = "string" @@ -63,6 +69,12 @@ variable "cpu_high_silenced" { default = {} } +variable "cpu_high_extra_tags" { + description = "Extra tags for Elasticache redis cpu high monitor" + type = "list" + default = [] +} + variable "cpu_high_message" { description = "Custom message for Elasticache redis cpu high monitor" type = "string" @@ -96,6 +108,12 @@ variable "replication_lag_silenced" { default = {} } +variable "replication_lag_extra_tags" { + description = "Extra tags for Elasticache redis replication lag monitor" + type = "list" + default = [] +} + variable "replication_lag_message" { description = "Custom message for Elasticache redis replication lag monitor" type = "string" @@ -129,6 +147,12 @@ variable "commands_silenced" { default = {} } +variable "commands_extra_tags" { + description = "Extra tags for Elasticache redis commands monitor" + type = "list" + default = [] +} + variable "commands_message" { description = "Custom message for Elasticache redis commands monitor" type = "string" diff --git a/cloud/aws/elasticache/redis/monitors-redis.tf b/cloud/aws/elasticache/redis/monitors-redis.tf index e37f163..bb4991a 100644 --- a/cloud/aws/elasticache/redis/monitors-redis.tf +++ b/cloud/aws/elasticache/redis/monitors-redis.tf @@ -84,7 +84,7 @@ resource "datadog_monitor" "redis_cache_hits" { silenced = "${var.cache_hits_silenced}" - tags = ["env:${var.environment}", "engine:redis", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "${var.cache_hits_extra_tags}"] } resource "datadog_monitor" "redis_cpu_high" { @@ -111,7 +111,7 @@ resource "datadog_monitor" "redis_cpu_high" { silenced = "${var.cpu_high_silenced}" - tags = ["env:${var.environment}", "engine:redis", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "${var.cpu_high_extra_tags}"] } resource "datadog_monitor" "redis_replication_lag" { @@ -143,7 +143,7 @@ resource "datadog_monitor" "redis_replication_lag" { silenced = "${var.replication_lag_silenced}" - tags = ["env:${var.environment}", "engine:redis", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "${var.replication_lag_extra_tags}"] } resource "datadog_monitor" "redis_commands" { @@ -171,5 +171,5 @@ resource "datadog_monitor" "redis_commands" { silenced = "${var.commands_silenced}" - tags = ["env:${var.environment}", "engine:redis", "team:aws", "provider:aws"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "${var.commands_extra_tags}"] }