From b093f2f1e490caa0247b1b02dcb9de763a749867 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Respaut?= Date: Thu, 6 Jun 2019 15:17:28 +0200 Subject: [PATCH 01/26] MON-459: Bump to HCL 2 syntax / tf 0.12.1 --- .gitlab-ci.yml | 2 +- caas/kubernetes/ark/inputs.tf | 9 +- caas/kubernetes/ark/modules.tf | 9 +- caas/kubernetes/ark/monitors-ark.tf | 31 +- caas/kubernetes/ark/outputs.tf | 3 +- caas/kubernetes/ark/versions.tf | 4 + caas/kubernetes/cluster/inputs.tf | 9 +- caas/kubernetes/cluster/modules.tf | 9 +- .../cluster/monitors-k8s-cluster.tf | 25 +- caas/kubernetes/cluster/outputs.tf | 3 +- caas/kubernetes/cluster/versions.tf | 4 + caas/kubernetes/ingress/vts/inputs.tf | 27 +- caas/kubernetes/ingress/vts/modules.tf | 25 +- .../ingress/vts/monitors-ingress.tf | 73 +- caas/kubernetes/ingress/vts/outputs.tf | 5 +- caas/kubernetes/ingress/vts/versions.tf | 4 + caas/kubernetes/node/inputs.tf | 89 +- caas/kubernetes/node/modules.tf | 17 +- caas/kubernetes/node/monitors-k8s-node.tf | 293 +++--- caas/kubernetes/node/outputs.tf | 21 +- caas/kubernetes/node/versions.tf | 4 + caas/kubernetes/pod/inputs.tf | 21 +- caas/kubernetes/pod/modules.tf | 25 +- caas/kubernetes/pod/monitors-k8s-pod.tf | 69 +- caas/kubernetes/pod/outputs.tf | 5 +- caas/kubernetes/pod/versions.tf | 4 + caas/kubernetes/workload/inputs.tf | 47 +- caas/kubernetes/workload/modules.tf | 9 +- .../workload/monitors-k8s-workload.tf | 143 +-- caas/kubernetes/workload/outputs.tf | 11 +- caas/kubernetes/workload/versions.tf | 4 + cloud/aws/alb/inputs.tf | 63 +- cloud/aws/alb/modules.tf | 9 +- cloud/aws/alb/monitors-alb.tf | 184 ++-- cloud/aws/alb/outputs.tf | 13 +- cloud/aws/alb/versions.tf | 4 + cloud/aws/apigateway/inputs.tf | 33 +- cloud/aws/apigateway/monitors-api.tf | 97 +- cloud/aws/apigateway/outputs.tf | 7 +- cloud/aws/apigateway/versions.tf | 4 + cloud/aws/elasticache/common/inputs.tf | 77 +- cloud/aws/elasticache/common/modules.tf | 9 +- .../common/monitors-elasticache.tf | 191 ++-- cloud/aws/elasticache/common/outputs.tf | 13 +- cloud/aws/elasticache/common/versions.tf | 4 + cloud/aws/elasticache/memcached/inputs.tf | 31 +- cloud/aws/elasticache/memcached/modules.tf | 9 +- .../memcached/monitors-memcached.tf | 71 +- cloud/aws/elasticache/memcached/outputs.tf | 5 +- cloud/aws/elasticache/memcached/versions.tf | 4 + cloud/aws/elasticache/redis/inputs.tf | 53 +- cloud/aws/elasticache/redis/modules.tf | 9 +- cloud/aws/elasticache/redis/monitors-redis.tf | 113 +-- cloud/aws/elasticache/redis/outputs.tf | 9 +- cloud/aws/elasticache/redis/versions.tf | 4 + cloud/aws/elasticsearch/inputs.tf | 31 +- cloud/aws/elasticsearch/modules.tf | 9 +- .../elasticsearch/monitors-elasticsearch.tf | 109 ++- cloud/aws/elasticsearch/outputs.tf | 7 +- cloud/aws/elasticsearch/versions.tf | 4 + cloud/aws/elb/inputs.tf | 55 +- cloud/aws/elb/modules.tf | 9 +- cloud/aws/elb/monitors-elb.tf | 215 +++-- cloud/aws/elb/outputs.tf | 13 +- cloud/aws/elb/versions.tf | 4 + cloud/aws/kinesis-firehose/inputs.tf | 9 +- cloud/aws/kinesis-firehose/modules.tf | 9 +- .../monitors-kinesis-firehose.tf | 28 +- cloud/aws/kinesis-firehose/outputs.tf | 3 +- cloud/aws/kinesis-firehose/versions.tf | 4 + cloud/aws/rds/aurora/mysql/inputs.tf | 11 +- cloud/aws/rds/aurora/mysql/modules.tf | 9 +- .../aurora/mysql/monitors-rds-aurora-mysql.tf | 30 +- cloud/aws/rds/aurora/mysql/outputs.tf | 3 +- cloud/aws/rds/aurora/mysql/versions.tf | 4 + cloud/aws/rds/aurora/postgresql/inputs.tf | 11 +- cloud/aws/rds/aurora/postgresql/modules.tf | 9 +- .../monitors-rds-aurora-postgresql.tf | 30 +- cloud/aws/rds/aurora/postgresql/outputs.tf | 3 +- cloud/aws/rds/aurora/postgresql/versions.tf | 4 + cloud/aws/rds/common/inputs.tf | 31 +- cloud/aws/rds/common/modules.tf | 9 +- cloud/aws/rds/common/monitors-rds-common.tf | 106 ++- cloud/aws/rds/common/outputs.tf | 7 +- cloud/aws/rds/common/versions.tf | 4 + cloud/aws/vpn/inputs.tf | 13 +- cloud/aws/vpn/monitors-vpn.tf | 26 +- cloud/aws/vpn/outputs.tf | 3 +- cloud/aws/vpn/versions.tf | 4 + cloud/azure/apimanagement/inputs.tf | 53 +- cloud/azure/apimanagement/modules.tf | 9 +- .../monitors-azure-apimanagement.tf | 164 ++-- cloud/azure/apimanagement/outputs.tf | 11 +- cloud/azure/apimanagement/versions.tf | 4 + cloud/azure/app-services/inputs.tf | 67 +- cloud/azure/app-services/modules.tf | 9 +- .../app-services/monitors-app_services.tf | 181 ++-- cloud/azure/app-services/outputs.tf | 13 +- cloud/azure/app-services/versions.tf | 4 + cloud/azure/azure-search/inputs.tf | 23 +- cloud/azure/azure-search/modules.tf | 9 +- .../azure-search/monitors-azure-search.tf | 65 +- cloud/azure/azure-search/outputs.tf | 5 +- cloud/azure/azure-search/versions.tf | 4 + cloud/azure/cosmosdb/inputs.tf | 43 +- cloud/azure/cosmosdb/modules.tf | 17 +- cloud/azure/cosmosdb/monitors-cosmosdb.tf | 141 ++- cloud/azure/cosmosdb/outputs.tf | 9 +- cloud/azure/cosmosdb/versions.tf | 4 + cloud/azure/datalakestore/inputs.tf | 11 +- cloud/azure/datalakestore/modules.tf | 9 +- .../datalakestore/monitors-datalakestore.tf | 29 +- cloud/azure/datalakestore/outputs.tf | 3 +- cloud/azure/datalakestore/versions.tf | 4 + cloud/azure/eventgrid/inputs.tf | 33 +- cloud/azure/eventgrid/modules.tf | 9 +- cloud/azure/eventgrid/monitors-eventgrid.tf | 112 ++- cloud/azure/eventgrid/outputs.tf | 7 +- cloud/azure/eventgrid/versions.tf | 4 + cloud/azure/eventhub/inputs.tf | 33 +- cloud/azure/eventhub/modules.tf | 9 +- cloud/azure/eventhub/monitors-eventhub.tf | 112 ++- cloud/azure/eventhub/outputs.tf | 7 +- cloud/azure/eventhub/versions.tf | 4 + cloud/azure/functions/inputs.tf | 33 +- cloud/azure/functions/modules.tf | 9 +- cloud/azure/functions/monitors-functions.tf | 100 +- cloud/azure/functions/outputs.tf | 7 +- cloud/azure/functions/versions.tf | 4 + cloud/azure/iothubs/inputs.tf | 141 +-- cloud/azure/iothubs/modules.tf | 7 +- cloud/azure/iothubs/monitors-iothubs.tf | 467 +++++----- cloud/azure/iothubs/outputs.tf | 29 +- cloud/azure/iothubs/versions.tf | 4 + cloud/azure/keyvault/inputs.tf | 27 +- cloud/azure/keyvault/modules.tf | 25 +- cloud/azure/keyvault/monitors-keyvault.tf | 115 ++- cloud/azure/keyvault/outputs.tf | 7 +- cloud/azure/keyvault/versions.tf | 4 + cloud/azure/load-balancer/inputs.tf | 11 +- cloud/azure/load-balancer/modules.tf | 9 +- .../load-balancer/monitors-load-balancer.tf | 29 +- cloud/azure/load-balancer/outputs.tf | 3 +- cloud/azure/load-balancer/versions.tf | 4 + cloud/azure/mysql/inputs.tf | 43 +- cloud/azure/mysql/modules.tf | 7 +- cloud/azure/mysql/monitors-mysql.tf | 140 ++- cloud/azure/mysql/outputs.tf | 9 +- cloud/azure/mysql/versions.tf | 4 + cloud/azure/postgresql/inputs.tf | 53 +- cloud/azure/postgresql/modules.tf | 7 +- .../azure/postgresql/monitors-postegresql.tf | 165 ++-- cloud/azure/postgresql/outputs.tf | 11 +- cloud/azure/postgresql/versions.tf | 4 + cloud/azure/redis/inputs.tf | 43 +- cloud/azure/redis/modules.tf | 9 +- cloud/azure/redis/monitors-azure-redis.tf | 133 ++- cloud/azure/redis/outputs.tf | 9 +- cloud/azure/redis/versions.tf | 4 + cloud/azure/serverfarms/inputs.tf | 33 +- cloud/azure/serverfarms/modules.tf | 7 +- .../serverfarms/monitors-azure-serverfarms.tf | 112 ++- cloud/azure/serverfarms/outputs.tf | 7 +- cloud/azure/serverfarms/versions.tf | 4 + cloud/azure/servicebus/inputs.tf | 35 +- cloud/azure/servicebus/modules.tf | 9 +- .../azure/servicebus/monitors-service-bus.tf | 127 ++- cloud/azure/servicebus/outputs.tf | 9 +- cloud/azure/servicebus/versions.tf | 4 + cloud/azure/sql-database/inputs.tf | 51 +- cloud/azure/sql-database/modules.tf | 9 +- .../sql-database/monitors-sql-database.tf | 158 ++-- cloud/azure/sql-database/outputs.tf | 11 +- cloud/azure/sql-database/versions.tf | 4 + cloud/azure/sql-elasticpool/inputs.tf | 33 +- cloud/azure/sql-elasticpool/modules.tf | 9 +- .../monitors-sql-elasticpool.tf | 114 ++- cloud/azure/sql-elasticpool/outputs.tf | 7 +- cloud/azure/sql-elasticpool/versions.tf | 4 + cloud/azure/storage/inputs.tf | 93 +- cloud/azure/storage/modules.tf | 9 +- cloud/azure/storage/monitors-azure-storage.tf | 302 +++--- cloud/azure/storage/outputs.tf | 19 +- cloud/azure/storage/versions.tf | 4 + cloud/azure/stream-analytics/inputs.tf | 53 +- cloud/azure/stream-analytics/modules.tf | 9 +- .../monitors-stream-analytics.tf | 172 ++-- cloud/azure/stream-analytics/outputs.tf | 11 +- cloud/azure/stream-analytics/versions.tf | 4 + cloud/azure/virtual-machine/inputs.tf | 33 +- cloud/azure/virtual-machine/modules.tf | 9 +- .../monitors-virtual-machine.tf | 113 ++- cloud/azure/virtual-machine/outputs.tf | 7 +- cloud/azure/virtual-machine/versions.tf | 4 + cloud/gcp/big-query/inputs.tf | 111 +-- cloud/gcp/big-query/monitors-big-query.tf | 332 +++---- cloud/gcp/big-query/outputs.tf | 19 +- cloud/gcp/big-query/versions.tf | 4 + cloud/gcp/cloud-sql/common/inputs.tf | 89 +- .../common/monitors-cloud-sql-common.tf | 249 ++--- cloud/gcp/cloud-sql/common/outputs.tf | 13 +- cloud/gcp/cloud-sql/common/versions.tf | 4 + cloud/gcp/cloud-sql/mysql/inputs.tf | 17 +- .../mysql/monitors-cloudsql-mysql.tf | 39 +- cloud/gcp/cloud-sql/mysql/outputs.tf | 3 +- cloud/gcp/cloud-sql/mysql/versions.tf | 4 + cloud/gcp/gce/instance/inputs.tf | 49 +- .../gcp/gce/instance/monitors-gce-instance.tf | 114 ++- cloud/gcp/gce/instance/outputs.tf | 7 +- cloud/gcp/gce/instance/versions.tf | 4 + cloud/gcp/lb/inputs.tf | 79 +- cloud/gcp/lb/monitors-lb.tf | 166 ++-- cloud/gcp/lb/outputs.tf | 11 +- cloud/gcp/lb/versions.tf | 4 + cloud/gcp/pubsub/inputs.tf | 29 +- cloud/gcp/pubsub/monitors-pubsub.tf | 73 +- cloud/gcp/pubsub/outputs.tf | 5 +- cloud/gcp/pubsub/versions.tf | 4 + common/alerting-message/inputs.tf | 11 +- common/alerting-message/main.tf | 14 +- common/alerting-message/outputs.tf | 3 +- common/alerting-message/versions.tf | 4 + common/filter-tags/inputs.tf | 9 +- common/filter-tags/locals.tf | 36 +- common/filter-tags/outputs.tf | 11 +- common/filter-tags/versions.tf | 4 + database/elasticsearch/inputs.tf | 331 +++---- database/elasticsearch/modules.tf | 9 +- .../elasticsearch/monitors-elasticsearch.tf | 866 +++++++----------- database/elasticsearch/outputs.tf | 45 +- database/elasticsearch/versions.tf | 4 + database/mongodb/inputs.tf | 41 +- database/mongodb/modules.tf | 17 +- database/mongodb/monitors-mongo.tf | 128 ++- database/mongodb/outputs.tf | 9 +- database/mongodb/versions.tf | 4 + database/mysql/inputs.tf | 111 +-- database/mysql/modules.tf | 9 +- database/mysql/monitors-mysql.tf | 247 +++-- database/mysql/outputs.tf | 17 +- database/mysql/versions.tf | 4 + database/postgresql/inputs.tf | 33 +- database/postgresql/modules.tf | 9 +- database/postgresql/monitors-postgresql.tf | 102 +-- database/postgresql/outputs.tf | 7 +- database/postgresql/versions.tf | 4 + database/redis/inputs.tf | 103 +-- database/redis/modules.tf | 9 +- database/redis/monitors-redis.tf | 350 ++++--- database/redis/outputs.tf | 21 +- database/redis/versions.tf | 4 + incubator/monitors-apache-nat.tf | 3 +- incubator/monitors-cassandra.tf | 1 - incubator/monitors-gcp-cloud-sql.tf | 3 +- incubator/monitors-gcp-lb.tf | 3 +- incubator/monitors-gcp-vpn.tf | 3 +- incubator/monitors-kubernetes.tf | 7 +- incubator/monitors-linux-basics.tf | 17 +- incubator/monitors-redis-containers.tf | 5 +- incubator/monitors-redis.tf | 3 +- incubator/versions.tf | 4 + middleware/apache/inputs.tf | 11 +- middleware/apache/modules.tf | 9 +- middleware/apache/monitors-apache.tf | 26 +- middleware/apache/outputs.tf | 3 +- middleware/apache/versions.tf | 4 + middleware/nginx/inputs.tf | 23 +- middleware/nginx/modules.tf | 9 +- middleware/nginx/monitors-nginx.tf | 65 +- middleware/nginx/outputs.tf | 5 +- middleware/nginx/versions.tf | 4 + middleware/php-fpm/inputs.tf | 23 +- middleware/php-fpm/modules.tf | 9 +- middleware/php-fpm/monitors-fpm.tf | 67 +- middleware/php-fpm/outputs.tf | 5 +- middleware/php-fpm/versions.tf | 4 + system/generic/inputs.tf | 75 +- system/generic/modules.tf | 17 +- system/generic/monitors-system.tf | 219 ++--- system/generic/outputs.tf | 13 +- system/generic/versions.tf | 4 + system/unreachable/inputs.tf | 11 +- system/unreachable/modules.tf | 9 +- system/unreachable/monitors-unreachable.tf | 32 +- system/unreachable/outputs.tf | 3 +- system/unreachable/versions.tf | 4 + testing/dummy/dummy.tf | 4 +- testing/dummy/versions.tf | 4 + 288 files changed, 6096 insertions(+), 5952 deletions(-) create mode 100644 caas/kubernetes/ark/versions.tf create mode 100644 caas/kubernetes/cluster/versions.tf create mode 100644 caas/kubernetes/ingress/vts/versions.tf create mode 100644 caas/kubernetes/node/versions.tf create mode 100644 caas/kubernetes/pod/versions.tf create mode 100644 caas/kubernetes/workload/versions.tf create mode 100644 cloud/aws/alb/versions.tf create mode 100644 cloud/aws/apigateway/versions.tf create mode 100644 cloud/aws/elasticache/common/versions.tf create mode 100644 cloud/aws/elasticache/memcached/versions.tf create mode 100644 cloud/aws/elasticache/redis/versions.tf create mode 100644 cloud/aws/elasticsearch/versions.tf create mode 100644 cloud/aws/elb/versions.tf create mode 100644 cloud/aws/kinesis-firehose/versions.tf create mode 100644 cloud/aws/rds/aurora/mysql/versions.tf create mode 100644 cloud/aws/rds/aurora/postgresql/versions.tf create mode 100644 cloud/aws/rds/common/versions.tf create mode 100644 cloud/aws/vpn/versions.tf create mode 100644 cloud/azure/apimanagement/versions.tf create mode 100644 cloud/azure/app-services/versions.tf create mode 100644 cloud/azure/azure-search/versions.tf create mode 100644 cloud/azure/cosmosdb/versions.tf create mode 100644 cloud/azure/datalakestore/versions.tf create mode 100644 cloud/azure/eventgrid/versions.tf create mode 100644 cloud/azure/eventhub/versions.tf create mode 100644 cloud/azure/functions/versions.tf create mode 100644 cloud/azure/iothubs/versions.tf create mode 100644 cloud/azure/keyvault/versions.tf create mode 100644 cloud/azure/load-balancer/versions.tf create mode 100644 cloud/azure/mysql/versions.tf create mode 100644 cloud/azure/postgresql/versions.tf create mode 100644 cloud/azure/redis/versions.tf create mode 100644 cloud/azure/serverfarms/versions.tf create mode 100644 cloud/azure/servicebus/versions.tf create mode 100644 cloud/azure/sql-database/versions.tf create mode 100644 cloud/azure/sql-elasticpool/versions.tf create mode 100644 cloud/azure/storage/versions.tf create mode 100644 cloud/azure/stream-analytics/versions.tf create mode 100644 cloud/azure/virtual-machine/versions.tf create mode 100644 cloud/gcp/big-query/versions.tf create mode 100644 cloud/gcp/cloud-sql/common/versions.tf create mode 100644 cloud/gcp/cloud-sql/mysql/versions.tf create mode 100644 cloud/gcp/gce/instance/versions.tf create mode 100644 cloud/gcp/lb/versions.tf create mode 100644 cloud/gcp/pubsub/versions.tf create mode 100644 common/alerting-message/versions.tf create mode 100644 common/filter-tags/versions.tf create mode 100644 database/elasticsearch/versions.tf create mode 100644 database/mongodb/versions.tf create mode 100644 database/mysql/versions.tf create mode 100644 database/postgresql/versions.tf create mode 100644 database/redis/versions.tf create mode 100644 incubator/versions.tf create mode 100644 middleware/apache/versions.tf create mode 100644 middleware/nginx/versions.tf create mode 100644 middleware/php-fpm/versions.tf create mode 100644 system/generic/versions.tf create mode 100644 system/unreachable/versions.tf create mode 100644 testing/dummy/versions.tf diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 4ec2c9c..c2f5f05 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ before_script: - apk add --no-cache curl auto_update: - image: hashicorp/terraform:0.11.14 + image: hashicorp/terraform:0.12.1 stage: test script: - apk add --no-cache bash git grep coreutils diff --git a/caas/kubernetes/ark/inputs.tf b/caas/kubernetes/ark/inputs.tf index 2e5d4cc..c62fb1c 100644 --- a/caas/kubernetes/ark/inputs.tf +++ b/caas/kubernetes/ark/inputs.tf @@ -42,25 +42,25 @@ variable "prefix_slug" { variable "ark_schedules_monitor_message" { description = "Custom message for Ark schedules monitor" - type = "string" + type = string default = "" } variable "ark_schedules_monitor_timeframe" { description = "Monitor timeframe for Ark schedules monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_1d" } variable "ark_schedules_enabled" { description = "Flag to enable Ark schedules monitor" - type = "string" + type = string default = "true" } variable "ark_schedules_extra_tags" { description = "Extra tags for Ark schedules monitor" - type = "list" + type = list(string) default = [] } @@ -68,3 +68,4 @@ variable "ark_schedules_monitor_no_data_timeframe" { description = "No data timeframe in minutes" default = 1440 } + diff --git a/caas/kubernetes/ark/modules.tf b/caas/kubernetes/ark/modules.tf index 1271818..d3f43ff 100644 --- a/caas/kubernetes/ark/modules.tf +++ b/caas/kubernetes/ark/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "ark" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/caas/kubernetes/ark/monitors-ark.tf b/caas/kubernetes/ark/monitors-ark.tf index 5a502b2..60306af 100644 --- a/caas/kubernetes/ark/monitors-ark.tf +++ b/caas/kubernetes/ark/monitors-ark.tf @@ -1,29 +1,30 @@ resource "datadog_monitor" "ark_schedules_monitor" { - count = "${var.ark_schedules_enabled == "true" ? 1 : 0}" + count = var.ark_schedules_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Ark backup failed" type = "query alert" - message = "${coalesce(var.ark_schedules_monitor_message, var.message)}" + message = coalesce(var.ark_schedules_monitor_message, var.message) query = < 1 - EOQ +EOQ - thresholds { + thresholds = { critical = 1 - warning = 0 + warning = 0 } - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - no_data_timeframe = "${var.ark_schedules_monitor_no_data_timeframe}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + no_data_timeframe = var.ark_schedules_monitor_no_data_timeframe - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - tags = ["env:${var.environment}", "type:caas", "provider:prometheus", "resource:ark", "team:claranet", "created-by:terraform", "${var.ark_schedules_extra_tags}"] + tags = ["env:${var.environment}", "type:caas", "provider:prometheus", "resource:ark", "team:claranet", "created-by:terraform", var.ark_schedules_extra_tags] } + diff --git a/caas/kubernetes/ark/outputs.tf b/caas/kubernetes/ark/outputs.tf index 5ff741d..1c588cd 100644 --- a/caas/kubernetes/ark/outputs.tf +++ b/caas/kubernetes/ark/outputs.tf @@ -1,4 +1,5 @@ output "ark_schedules_monitor_id" { description = "id for monitor ark_schedules_monitor" - value = "${datadog_monitor.ark_schedules_monitor.*.id}" + value = datadog_monitor.ark_schedules_monitor.*.id } + diff --git a/caas/kubernetes/ark/versions.tf b/caas/kubernetes/ark/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/caas/kubernetes/ark/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/caas/kubernetes/cluster/inputs.tf b/caas/kubernetes/cluster/inputs.tf index 8f7cdb7..519f563 100644 --- a/caas/kubernetes/cluster/inputs.tf +++ b/caas/kubernetes/cluster/inputs.tf @@ -42,24 +42,25 @@ variable "prefix_slug" { variable "apiserver_enabled" { description = "Flag to enable API server monitor" - type = "string" + type = string default = "true" } variable "apiserver_extra_tags" { description = "Extra tags for API server monitor" - type = "list" + type = list(string) default = [] } variable "apiserver_message" { description = "Custom message for API server monitor" - type = "string" + type = string default = "" } variable "apiserver_threshold_warning" { description = "API server monitor (warning threshold)" - type = "string" + type = string default = 3 } + diff --git a/caas/kubernetes/cluster/modules.tf b/caas/kubernetes/cluster/modules.tf index ad6b115..a57cf43 100644 --- a/caas/kubernetes/cluster/modules.tf +++ b/caas/kubernetes/cluster/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "kubernetes" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/caas/kubernetes/cluster/monitors-k8s-cluster.tf b/caas/kubernetes/cluster/monitors-k8s-cluster.tf index ea97fc5..8a1e0a1 100644 --- a/caas/kubernetes/cluster/monitors-k8s-cluster.tf +++ b/caas/kubernetes/cluster/monitors-k8s-cluster.tf @@ -1,27 +1,28 @@ resource "datadog_monitor" "apiserver" { - count = "${var.apiserver_enabled == "true" ? 1 : 0}" + count = var.apiserver_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes API server does not respond" - message = "${coalesce(var.apiserver_message, var.message)}" + message = coalesce(var.apiserver_message, var.message) type = "service check" query = < ${var.ingress_5xx_threshold_critical} - EOQ +EOQ type = "query alert" - thresholds { - warning = "${var.ingress_5xx_threshold_warning}" - critical = "${var.ingress_5xx_threshold_critical}" + thresholds = { + warning = var.ingress_5xx_threshold_warning + critical = var.ingress_5xx_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform", "${var.ingress_5xx_extra_tags}"] + tags = ["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform", var.ingress_5xx_extra_tags] } resource "datadog_monitor" "nginx_ingress_too_many_4xx" { - count = "${var.ingress_4xx_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Nginx Ingress 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.ingress_4xx_message, var.message)}" + count = var.ingress_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Nginx Ingress 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.ingress_4xx_message, var.message) query = < ${var.ingress_4xx_threshold_critical} - EOQ +EOQ - type = "query alert" +type = "query alert" - thresholds { - warning = "${var.ingress_4xx_threshold_warning}" - critical = "${var.ingress_4xx_threshold_critical}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - - tags = ["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform", "${var.ingress_4xx_extra_tags}"] +thresholds = { +warning = var.ingress_4xx_threshold_warning +critical = var.ingress_4xx_threshold_critical } + +notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = true + +tags = ["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform", var.ingress_4xx_extra_tags] +} + diff --git a/caas/kubernetes/ingress/vts/outputs.tf b/caas/kubernetes/ingress/vts/outputs.tf index 28582f8..9c7e495 100644 --- a/caas/kubernetes/ingress/vts/outputs.tf +++ b/caas/kubernetes/ingress/vts/outputs.tf @@ -1,9 +1,10 @@ output "nginx_ingress_too_many_5xx_id" { description = "id for monitor nginx_ingress_too_many_5xx" - value = "${datadog_monitor.nginx_ingress_too_many_5xx.*.id}" + value = datadog_monitor.nginx_ingress_too_many_5xx.*.id } output "nginx_ingress_too_many_4xx_id" { description = "id for monitor nginx_ingress_too_many_4xx" - value = "${datadog_monitor.nginx_ingress_too_many_4xx.*.id}" + value = datadog_monitor.nginx_ingress_too_many_4xx.*.id } + diff --git a/caas/kubernetes/ingress/vts/versions.tf b/caas/kubernetes/ingress/vts/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/caas/kubernetes/ingress/vts/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/caas/kubernetes/node/inputs.tf b/caas/kubernetes/node/inputs.tf index 02f8148..967b8d9 100644 --- a/caas/kubernetes/node/inputs.tf +++ b/caas/kubernetes/node/inputs.tf @@ -42,175 +42,175 @@ variable "prefix_slug" { variable "disk_pressure_enabled" { description = "Flag to enable Disk pressure monitor" - type = "string" + type = string default = "true" } variable "disk_pressure_extra_tags" { description = "Extra tags for Disk pressure monitor" - type = "list" + type = list(string) default = [] } variable "disk_pressure_message" { description = "Custom message for Disk pressure monitor" - type = "string" + type = string default = "" } variable "disk_pressure_threshold_warning" { description = "Disk pressure monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "disk_out_enabled" { description = "Flag to enable Out of disk monitor" - type = "string" + type = string default = "true" } variable "disk_out_extra_tags" { description = "Extra tags for Out of disk monitor" - type = "list" + type = list(string) default = [] } variable "disk_out_message" { description = "Custom message for Out of disk monitor" - type = "string" + type = string default = "" } variable "disk_out_threshold_warning" { description = "Out of disk monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "memory_pressure_enabled" { description = "Flag to enable Memory pressure monitor" - type = "string" + type = string default = "true" } variable "memory_pressure_extra_tags" { description = "Extra tags for Memory pressure monitor" - type = "list" + type = list(string) default = [] } variable "memory_pressure_message" { description = "Custom message for Memory pressure monitor" - type = "string" + type = string default = "" } variable "memory_pressure_threshold_warning" { description = "Memory pressure monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "ready_enabled" { description = "Flag to enable Node ready monitor" - type = "string" + type = string default = "true" } variable "ready_extra_tags" { description = "Extra tags for Node ready monitor" - type = "list" + type = list(string) default = [] } variable "ready_message" { description = "Custom message for Node ready monitor" - type = "string" + type = string default = "" } variable "ready_threshold_warning" { description = "Node ready monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "kubelet_ping_enabled" { description = "Flag to enable Kubelet ping monitor" - type = "string" + type = string default = "true" } variable "kubelet_ping_extra_tags" { description = "Extra tags for Kubelet ping monitor" - type = "list" + type = list(string) default = [] } variable "kubelet_ping_message" { description = "Custom message for Kubelet ping monitor" - type = "string" + type = string default = "" } variable "kubelet_ping_threshold_warning" { description = "Kubelet ping monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "kubelet_syncloop_enabled" { description = "Flag to enable Kubelet sync loop monitor" - type = "string" + type = string default = "true" } variable "kubelet_syncloop_extra_tags" { description = "Extra tags for Kubelet sync loop monitor" - type = "list" + type = list(string) default = [] } variable "kubelet_syncloop_message" { description = "Custom message for Kubelet sync loop monitor" - type = "string" + type = string default = "" } variable "kubelet_syncloop_threshold_warning" { description = "Kubelet sync loop monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "unregister_net_device_enabled" { description = "Flag to enable Unregister net device monitor" - type = "string" + type = string default = "true" } variable "unregister_net_device_extra_tags" { description = "Extra tags for Unregister net device monitor" - type = "list" + type = list(string) default = [] } variable "unregister_net_device_message" { description = "Custom message for Unregister net device monitor" - type = "string" + type = string default = "" } variable "unregister_net_device_time_aggregator" { description = "Monitor aggregator for Unregister net device [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "unregister_net_device_timeframe" { description = "Monitor timeframe for Unregister net device [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "15m" } @@ -221,61 +221,61 @@ variable "unregister_net_device_threshold_critical" { variable "node_unschedulable_enabled" { description = "Flag to enable node unschedulable monitor" - type = "string" + type = string default = "true" } variable "node_unschedulable_extra_tags" { description = "Extra tags for node unschedulable monitor" - type = "list" + type = list(string) default = [] } variable "node_unschedulable_message" { description = "Custom message for node unschedulable monitor" - type = "string" + type = string default = "" } variable "node_unschedulable_time_aggregator" { description = "Monitor aggregator for node unschedulable [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "node_unschedulable_timeframe" { description = "Monitor timeframe for node unschedulable [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_1h" } variable "volume_space_enabled" { description = "Flag to enable Volume space monitor" - type = "string" + type = string default = "true" } variable "volume_space_extra_tags" { description = "Extra tags for Volume space monitor" - type = "list" + type = list(string) default = [] } variable "volume_space_message" { description = "Custom message for Volume space monitor" - type = "string" + type = string default = "" } variable "volume_space_time_aggregator" { description = "Monitor aggregator for Volume space [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "volume_space_timeframe" { description = "Monitor timeframe for Volume space [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -291,31 +291,31 @@ variable "volume_space_threshold_warning" { variable "volume_inodes_enabled" { description = "Flag to enable Volume inodes monitor" - type = "string" + type = string default = "true" } variable "volume_inodes_extra_tags" { description = "Extra tags for Volume inodes monitor" - type = "list" + type = list(string) default = [] } variable "volume_inodes_message" { description = "Custom message for Volume inodes monitor" - type = "string" + type = string default = "" } variable "volume_inodes_time_aggregator" { description = "Monitor aggregator for Volume inodes [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "volume_inodes_timeframe" { description = "Monitor timeframe for Volume inodes [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -328,3 +328,4 @@ variable "volume_inodes_threshold_warning" { default = 90 description = "Volume inodes warning threshold" } + diff --git a/caas/kubernetes/node/modules.tf b/caas/kubernetes/node/modules.tf index 0dee522..20f05b0 100644 --- a/caas/kubernetes/node/modules.tf +++ b/caas/kubernetes/node/modules.tf @@ -1,20 +1,21 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "kubernetes" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } module "filter-tags-unschedulable" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "kubernetes" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded extra_tags = ["status:unschedulable"] } + diff --git a/caas/kubernetes/node/monitors-k8s-node.tf b/caas/kubernetes/node/monitors-k8s-node.tf index cca6ed1..23e82cd 100644 --- a/caas/kubernetes/node/monitors-k8s-node.tf +++ b/caas/kubernetes/node/monitors-k8s-node.tf @@ -1,104 +1,104 @@ resource "datadog_monitor" "disk_pressure" { - count = "${var.disk_pressure_enabled == "true" ? 1 : 0}" + count = var.disk_pressure_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node Disk pressure" - message = "${coalesce(var.disk_pressure_message, var.message)}" + message = coalesce(var.disk_pressure_message, var.message) type = "service check" query = < ${var.unregister_net_device_threshold_critical} - EOQ +EOQ - new_host_delay = "${var.new_host_delay}" +new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", "${var.unregister_net_device_extra_tags}"] +tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.unregister_net_device_extra_tags] } resource "datadog_monitor" "node_unschedulable" { - count = "${var.node_unschedulable_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node unschedulable" - type = "metric alert" - message = "${coalesce(var.node_unschedulable_message, var.message)}" +count = var.node_unschedulable_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node unschedulable" +type = "metric alert" +message = coalesce(var.node_unschedulable_message, var.message) - query = < 0 - EOQ +EOQ - thresholds { + thresholds = { critical = 0 } - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 @@ -215,69 +215,70 @@ resource "datadog_monitor" "node_unschedulable" { locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", "${var.node_unschedulable_extra_tags}"] + tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.node_unschedulable_extra_tags] } resource "datadog_monitor" "volume_space" { - count = "${var.volume_space_enabled == "true" ? 1 : 0}" + count = var.volume_space_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node volume space usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" type = "query alert" - message = "${coalesce(var.volume_space_message, var.message)}" + message = coalesce(var.volume_space_message, var.message) query = < ${var.volume_space_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.volume_space_threshold_critical}" - warning = "${var.volume_space_threshold_warning}" + thresholds = { + critical = var.volume_space_threshold_critical + warning = var.volume_space_threshold_warning } - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", "${var.volume_space_extra_tags}"] + tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.volume_space_extra_tags] } resource "datadog_monitor" "volume_inodes" { - count = "${var.volume_inodes_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node volume inodes usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.volume_inodes_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node volume inodes usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" type = "query alert" - message = "${coalesce(var.volume_inodes_message, var.message)}" + message = coalesce(var.volume_inodes_message, var.message) query = < ${var.volume_inodes_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.volume_inodes_threshold_critical}" - warning = "${var.volume_inodes_threshold_warning}" - } - - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", "${var.volume_inodes_extra_tags}"] +thresholds = { +critical = var.volume_inodes_threshold_critical +warning = var.volume_inodes_threshold_warning } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay + +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = true + +tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.volume_inodes_extra_tags] +} + diff --git a/caas/kubernetes/node/outputs.tf b/caas/kubernetes/node/outputs.tf index b88a1d3..af39519 100644 --- a/caas/kubernetes/node/outputs.tf +++ b/caas/kubernetes/node/outputs.tf @@ -1,49 +1,50 @@ output "disk_pressure_id" { description = "id for monitor disk_pressure" - value = "${datadog_monitor.disk_pressure.*.id}" + value = datadog_monitor.disk_pressure.*.id } output "disk_out_id" { description = "id for monitor disk_out" - value = "${datadog_monitor.disk_out.*.id}" + value = datadog_monitor.disk_out.*.id } output "memory_pressure_id" { description = "id for monitor memory_pressure" - value = "${datadog_monitor.memory_pressure.*.id}" + value = datadog_monitor.memory_pressure.*.id } output "ready_id" { description = "id for monitor ready" - value = "${datadog_monitor.ready.*.id}" + value = datadog_monitor.ready.*.id } output "kubelet_ping_id" { description = "id for monitor kubelet_ping" - value = "${datadog_monitor.kubelet_ping.*.id}" + value = datadog_monitor.kubelet_ping.*.id } output "kubelet_syncloop_id" { description = "id for monitor kubelet_syncloop" - value = "${datadog_monitor.kubelet_syncloop.*.id}" + value = datadog_monitor.kubelet_syncloop.*.id } output "unregister_net_device_id" { description = "id for monitor unregister_net_device" - value = "${datadog_monitor.unregister_net_device.*.id}" + value = datadog_monitor.unregister_net_device.*.id } output "node_unschedulable_id" { description = "id for monitor node_unschedulable" - value = "${datadog_monitor.node_unschedulable.*.id}" + value = datadog_monitor.node_unschedulable.*.id } output "volume_space_id" { description = "id for monitor volume_space" - value = "${datadog_monitor.volume_space.*.id}" + value = datadog_monitor.volume_space.*.id } output "volume_inodes_id" { description = "id for monitor volume_inodes" - value = "${datadog_monitor.volume_inodes.*.id}" + value = datadog_monitor.volume_inodes.*.id } + diff --git a/caas/kubernetes/node/versions.tf b/caas/kubernetes/node/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/caas/kubernetes/node/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/caas/kubernetes/pod/inputs.tf b/caas/kubernetes/pod/inputs.tf index 69b56af..73f74da 100644 --- a/caas/kubernetes/pod/inputs.tf +++ b/caas/kubernetes/pod/inputs.tf @@ -42,61 +42,61 @@ variable "prefix_slug" { variable "pod_phase_status_enabled" { description = "Flag to enable Pod phase status monitor" - type = "string" + type = string default = "true" } variable "pod_phase_status_extra_tags" { description = "Extra tags for Pod phase status monitor" - type = "list" + type = list(string) default = [] } variable "pod_phase_status_message" { description = "Custom message for Pod phase status monitor" - type = "string" + type = string default = "" } variable "pod_phase_status_time_aggregator" { description = "Monitor aggregator for Pod phase status [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "pod_phase_status_timeframe" { description = "Monitor timeframe for Pod phase status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "error_enabled" { description = "Flag to enable Pod errors monitor" - type = "string" + type = string default = "true" } variable "error_extra_tags" { description = "Extra tags for Pod errors monitor" - type = "list" + type = list(string) default = [] } variable "error_message" { description = "Custom message for Pod errors monitor" - type = "string" + type = string default = "" } variable "error_time_aggregator" { description = "Monitor aggregator for Pod errors [available values: min, max or avg]" - type = "string" + type = string default = "sum" } variable "error_timeframe" { description = "Monitor timeframe for Pod errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -109,3 +109,4 @@ variable "error_threshold_warning" { default = 0 description = "error warning threshold" } + diff --git a/caas/kubernetes/pod/modules.tf b/caas/kubernetes/pod/modules.tf index 07c1c59..eb818f5 100644 --- a/caas/kubernetes/pod/modules.tf +++ b/caas/kubernetes/pod/modules.tf @@ -1,31 +1,32 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "kubernetes" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } module "filter-tags-phase" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "kubernetes" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded extra_tags_excluded = ["phase:pending,phase:running,phase:succeeded,phase:unknown"] } module "filter-tags-nocontainercreating" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "kubernetes" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded extra_tags_excluded = ["reason:containercreating"] } + diff --git a/caas/kubernetes/pod/monitors-k8s-pod.tf b/caas/kubernetes/pod/monitors-k8s-pod.tf index 2ca4830..d98d036 100644 --- a/caas/kubernetes/pod/monitors-k8s-pod.tf +++ b/caas/kubernetes/pod/monitors-k8s-pod.tf @@ -1,59 +1,60 @@ resource "datadog_monitor" "pod_phase_status" { - count = "${var.pod_phase_status_enabled == "true" ? 1 : 0}" + count = var.pod_phase_status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Pod phase status failed" type = "metric alert" - message = "${coalesce(var.pod_phase_status_message, var.message)}" + message = coalesce(var.pod_phase_status_message, var.message) query = < 0 - EOQ +EOQ - thresholds { + thresholds = { critical = 0 } - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform", "${var.pod_phase_status_extra_tags}"] + tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform", var.pod_phase_status_extra_tags] } resource "datadog_monitor" "error" { - count = "${var.error_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Pod waiting errors" + count = var.error_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Pod waiting errors" type = "query alert" - message = "${coalesce(var.error_message, var.message)}" + message = coalesce(var.error_message, var.message) query = < ${var.error_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.error_threshold_critical}" - warning = "${var.error_threshold_warning}" - } - - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform", "${var.error_extra_tags}"] +thresholds = { +critical = var.error_threshold_critical +warning = var.error_threshold_warning } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay + +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = true + +tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform", var.error_extra_tags] +} + diff --git a/caas/kubernetes/pod/outputs.tf b/caas/kubernetes/pod/outputs.tf index 2aceb97..70cf2f9 100644 --- a/caas/kubernetes/pod/outputs.tf +++ b/caas/kubernetes/pod/outputs.tf @@ -1,9 +1,10 @@ output "pod_phase_status_id" { description = "id for monitor pod_phase_status" - value = "${datadog_monitor.pod_phase_status.*.id}" + value = datadog_monitor.pod_phase_status.*.id } output "error_id" { description = "id for monitor error" - value = "${datadog_monitor.error.*.id}" + value = datadog_monitor.error.*.id } + diff --git a/caas/kubernetes/pod/versions.tf b/caas/kubernetes/pod/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/caas/kubernetes/pod/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/caas/kubernetes/workload/inputs.tf b/caas/kubernetes/workload/inputs.tf index 25d2a7e..c1d4598 100644 --- a/caas/kubernetes/workload/inputs.tf +++ b/caas/kubernetes/workload/inputs.tf @@ -42,79 +42,79 @@ variable "prefix_slug" { variable "job_enabled" { description = "Flag to enable Job monitor" - type = "string" + type = string default = "true" } variable "job_extra_tags" { description = "Extra tags for Job monitor" - type = "list" + type = list(string) default = [] } variable "job_message" { description = "Custom message for Job monitor" - type = "string" + type = string default = "" } variable "job_threshold_warning" { description = "Job monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "cronjob_enabled" { description = "Flag to enable Cronjob monitor" - type = "string" + type = string default = "true" } variable "cronjob_extra_tags" { description = "Extra tags for Cronjob monitor" - type = "list" + type = list(string) default = [] } variable "cronjob_message" { description = "Custom message for Cronjob monitor" - type = "string" + type = string default = "" } variable "cronjob_threshold_warning" { description = "Cronjob monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "replica_available_enabled" { description = "Flag to enable Available replica monitor" - type = "string" + type = string default = "true" } variable "replica_available_extra_tags" { description = "Extra tags for Available replicamonitor" - type = "list" + type = list(string) default = [] } variable "replica_available_message" { description = "Custom message for Available replica monitor" - type = "string" + type = string default = "" } variable "replica_available_time_aggregator" { description = "Monitor aggregator for Available replica [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "replica_available_timeframe" { description = "Monitor timeframe for Available replica [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -125,31 +125,31 @@ variable "replica_available_threshold_critical" { variable "replica_ready_enabled" { description = "Flag to enable Ready replica monitor" - type = "string" + type = string default = "true" } variable "replica_ready_extra_tags" { description = "Extra tags for Ready replica monitor" - type = "list" + type = list(string) default = [] } variable "replica_ready_message" { description = "Custom message for Ready replica monitor" - type = "string" + type = string default = "" } variable "replica_ready_time_aggregator" { description = "Monitor aggregator for Ready replica [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "replica_ready_timeframe" { description = "Monitor timeframe for Ready replica [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -160,31 +160,31 @@ variable "replica_ready_threshold_critical" { variable "replica_current_enabled" { description = "Flag to enable Current replica monitor" - type = "string" + type = string default = "true" } variable "replica_current_extra_tags" { description = "Extra tags for Current replica monitor" - type = "list" + type = list(string) default = [] } variable "replica_current_message" { description = "Custom message for Current replica monitor" - type = "string" + type = string default = "" } variable "replica_current_time_aggregator" { description = "Monitor aggregator for Current replica [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "replica_current_timeframe" { description = "Monitor timeframe for Current replica [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -192,3 +192,4 @@ variable "replica_current_threshold_critical" { default = 1 description = "Current replica critical threshold" } + diff --git a/caas/kubernetes/workload/modules.tf b/caas/kubernetes/workload/modules.tf index ad6b115..a57cf43 100644 --- a/caas/kubernetes/workload/modules.tf +++ b/caas/kubernetes/workload/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "kubernetes" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/caas/kubernetes/workload/monitors-k8s-workload.tf b/caas/kubernetes/workload/monitors-k8s-workload.tf index bcfdcb6..6cc5561 100644 --- a/caas/kubernetes/workload/monitors-k8s-workload.tf +++ b/caas/kubernetes/workload/monitors-k8s-workload.tf @@ -1,109 +1,109 @@ resource "datadog_monitor" "job" { - count = "${var.job_enabled == "true" ? 1 : 0}" + count = var.job_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes job failed" - message = "${coalesce(var.job_message, var.message)}" + message = coalesce(var.job_message, var.message) type = "service check" query = < ${var.latency_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +critical = var.latency_threshold_critical +warning = var.latency_threshold_warning +} - thresholds { - critical = "${var.latency_threshold_critical}" - warning = "${var.latency_threshold_warning}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 0 +include_tags = true - notify_no_data = false - renotify_interval = 0 - require_full_window = false - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", "${var.latency_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.latency_extra_tags] } resource "datadog_monitor" "ALB_httpcode_5xx" { - count = "${var.httpcode_alb_5xx_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 5xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +count = var.httpcode_alb_5xx_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 5xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.httpcode_alb_5xx_message, var.message) type = "query alert" - message = "${coalesce(var.httpcode_alb_5xx_message, var.message)}" - query = < ${var.httpcode_alb_5xx_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +critical = var.httpcode_alb_5xx_threshold_critical +warning = var.httpcode_alb_5xx_threshold_warning +} - thresholds { - critical = "${var.httpcode_alb_5xx_threshold_critical}" - warning = "${var.httpcode_alb_5xx_threshold_warning}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 0 +include_tags = true - notify_no_data = false - renotify_interval = 0 - require_full_window = false - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", "${var.httpcode_alb_5xx_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.httpcode_alb_5xx_extra_tags] } resource "datadog_monitor" "ALB_httpcode_4xx" { - count = "${var.httpcode_alb_4xx_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 4xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +count = var.httpcode_alb_4xx_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 4xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.httpcode_alb_4xx_message, var.message) type = "query alert" - message = "${coalesce(var.httpcode_alb_4xx_message, var.message)}" - query = < ${var.httpcode_alb_4xx_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - critical = "${var.httpcode_alb_4xx_threshold_critical}" - warning = "${var.httpcode_alb_4xx_threshold_warning}" + thresholds = { + critical = var.httpcode_alb_4xx_threshold_critical + warning = var.httpcode_alb_4xx_threshold_warning } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = false timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", "${var.httpcode_alb_4xx_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.httpcode_alb_4xx_extra_tags] } resource "datadog_monitor" "ALB_httpcode_target_5xx" { - count = "${var.httpcode_target_5xx_enabled == "true" ? 1 : 0}" + count = var.httpcode_target_5xx_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB target HTTP code 5xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.httpcode_target_5xx_message, var.message) type = "query alert" - message = "${coalesce(var.httpcode_target_5xx_message, var.message)}" query = < ${var.httpcode_target_5xx_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - critical = "${var.httpcode_target_5xx_threshold_critical}" - warning = "${var.httpcode_target_5xx_threshold_warning}" + thresholds = { + critical = var.httpcode_target_5xx_threshold_critical + warning = var.httpcode_target_5xx_threshold_warning } - notify_no_data = false - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 require_full_window = false - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", "${var.httpcode_target_5xx_extra_tags}"] + timeout_h = 0 + include_tags = true + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.httpcode_target_5xx_extra_tags] } resource "datadog_monitor" "ALB_httpcode_target_4xx" { - count = "${var.httpcode_target_4xx_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB target HTTP code 4xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.httpcode_target_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB target HTTP code 4xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.httpcode_target_4xx_message, var.message) type = "query alert" - message = "${coalesce(var.httpcode_target_4xx_message, var.message)}" query = < ${var.httpcode_target_4xx_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - critical = "${var.httpcode_target_4xx_threshold_critical}" - warning = "${var.httpcode_target_4xx_threshold_warning}" - } - - notify_no_data = false - renotify_interval = 0 - require_full_window = false - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", "${var.httpcode_target_4xx_extra_tags}"] +thresholds = { +critical = var.httpcode_target_4xx_threshold_critical +warning = var.httpcode_target_4xx_threshold_warning } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 0 +include_tags = true + +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.httpcode_target_4xx_extra_tags] +} + diff --git a/cloud/aws/alb/outputs.tf b/cloud/aws/alb/outputs.tf index 9a88a81..dee5705 100644 --- a/cloud/aws/alb/outputs.tf +++ b/cloud/aws/alb/outputs.tf @@ -1,29 +1,30 @@ output "ALB_no_healthy_instances_id" { description = "id for monitor ALB_no_healthy_instances" - value = "${datadog_monitor.ALB_no_healthy_instances.*.id}" + value = datadog_monitor.ALB_no_healthy_instances.*.id } output "ALB_latency_id" { description = "id for monitor ALB_latency" - value = "${datadog_monitor.ALB_latency.*.id}" + value = datadog_monitor.ALB_latency.*.id } output "ALB_httpcode_5xx_id" { description = "id for monitor ALB_httpcode_5xx" - value = "${datadog_monitor.ALB_httpcode_5xx.*.id}" + value = datadog_monitor.ALB_httpcode_5xx.*.id } output "ALB_httpcode_4xx_id" { description = "id for monitor ALB_httpcode_4xx" - value = "${datadog_monitor.ALB_httpcode_4xx.*.id}" + value = datadog_monitor.ALB_httpcode_4xx.*.id } output "ALB_httpcode_target_5xx_id" { description = "id for monitor ALB_httpcode_target_5xx" - value = "${datadog_monitor.ALB_httpcode_target_5xx.*.id}" + value = datadog_monitor.ALB_httpcode_target_5xx.*.id } output "ALB_httpcode_target_4xx_id" { description = "id for monitor ALB_httpcode_target_4xx" - value = "${datadog_monitor.ALB_httpcode_target_4xx.*.id}" + value = datadog_monitor.ALB_httpcode_target_4xx.*.id } + diff --git a/cloud/aws/alb/versions.tf b/cloud/aws/alb/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/aws/alb/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/aws/apigateway/inputs.tf b/cloud/aws/apigateway/inputs.tf index b572377..9158d78 100644 --- a/cloud/aws/apigateway/inputs.tf +++ b/cloud/aws/apigateway/inputs.tf @@ -1,6 +1,6 @@ variable "environment" { description = "Environment" - type = "string" + type = string } variable "filter_tags" { @@ -33,31 +33,31 @@ variable "prefix_slug" { variable "latency_enabled" { description = "Flag to enable API Gateway latency monitor" - type = "string" + type = string default = "true" } variable "latency_extra_tags" { description = "Extra tags for API Gateway latency monitor" - type = "list" + type = list(string) default = [] } variable "latency_message" { description = "Custom message for API Gateway latency monitor" - type = "string" + type = string default = "" } variable "latency_time_aggregator" { description = "Monitor aggregator for API Gateway latency [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "latency_timeframe" { description = "Monitor timeframe for API latency [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -77,31 +77,31 @@ variable "latency_threshold_warning" { variable "http_5xx_requests_enabled" { description = "Flag to enable API Gateway HTTP 5xx requests monitor" - type = "string" + type = string default = "true" } variable "http_5xx_requests_extra_tags" { description = "Extra tags for API Gateway HTTP 5xx requests monitor" - type = "list" + type = list(string) default = [] } variable "http_5xx_requests_message" { description = "Custom message for API Gateway HTTP 5xx requests monitor" - type = "string" + type = string default = "" } variable "http_5xx_requests_time_aggregator" { description = "Monitor aggregator for API HTTP 5xx requests [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "http_5xx_requests_timeframe" { description = "Monitor timeframe for API HTTP 5xx requests [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -121,31 +121,31 @@ variable "http_5xx_requests_threshold_warning" { variable "http_4xx_requests_enabled" { description = "Flag to enable API Gateway HTTP 4xx requests monitor" - type = "string" + type = string default = "true" } variable "http_4xx_requests_extra_tags" { description = "Extra tags for API Gateway HTTP 4xx requests monitor" - type = "list" + type = list(string) default = [] } variable "http_4xx_requests_message" { description = "Custom message for API Gateway HTTP 4xx requests monitor" - type = "string" + type = string default = "" } variable "http_4xx_requests_time_aggregator" { description = "Monitor aggregator for API HTTP 4xx requests [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "http_4xx_requests_timeframe" { description = "Monitor timeframe for API HTTP 4xx requests [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -163,3 +163,4 @@ variable "artificial_requests_count" { default = 5 description = "Number of false requests used to mitigate false positive in case of low trafic" } + diff --git a/cloud/aws/apigateway/monitors-api.tf b/cloud/aws/apigateway/monitors-api.tf index 8352d10..948afce 100644 --- a/cloud/aws/apigateway/monitors-api.tf +++ b/cloud/aws/apigateway/monitors-api.tf @@ -1,91 +1,92 @@ # Monitoring Api Gateway latency resource "datadog_monitor" "API_Gateway_latency" { - count = "${var.latency_enabled == "true" ? 1 : 0}" + count = var.latency_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" type = "query alert" - message = "${coalesce(var.latency_message, var.message)}" + message = coalesce(var.latency_message, var.message) query = < ${var.latency_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - thresholds { - warning = "${var.latency_threshold_warning}" - critical = "${var.latency_threshold_critical}" + thresholds = { + warning = var.latency_threshold_warning + critical = var.latency_threshold_critical } - notify_no_data = false # Will NOT notify when no data is received - renotify_interval = 0 + notify_no_data = false + renotify_interval = 0 require_full_window = false - timeout_h = 0 - include_tags = true + timeout_h = 0 + include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform", "${var.latency_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform", var.latency_extra_tags] } # Monitoring API Gateway 5xx errors percent resource "datadog_monitor" "API_http_5xx_errors_count" { - count = "${var.http_5xx_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.http_5xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" type = "query alert" - message = "${coalesce(var.http_5xx_requests_message, var.message)}" + message = coalesce(var.http_5xx_requests_message, var.message) query = < ${var.http_5xx_requests_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay - thresholds { - warning = "${var.http_5xx_requests_threshold_warning}" - critical = "${var.http_5xx_requests_threshold_critical}" - } +thresholds = { +warning = var.http_5xx_requests_threshold_warning +critical = var.http_5xx_requests_threshold_critical +} - notify_no_data = false # Will NOT notify when no data is received - renotify_interval = 0 - require_full_window = false - timeout_h = 1 - include_tags = true +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 1 +include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform", "${var.http_5xx_requests_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform", var.http_5xx_requests_extra_tags] } # Monitoring API Gateway 4xx errors percent resource "datadog_monitor" "API_http_4xx_errors_count" { - count = "${var.http_4xx_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +count = var.http_4xx_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" type = "query alert" - message = "${coalesce(var.http_4xx_requests_message, var.message)}" +message = coalesce(var.http_4xx_requests_message, var.message) - query = < ${var.http_4xx_requests_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay - thresholds { - warning = "${var.http_4xx_requests_threshold_warning}" - critical = "${var.http_4xx_requests_threshold_critical}" - } - - notify_no_data = false # Will NOT notify when no data is received - renotify_interval = 0 - require_full_window = false - timeout_h = 1 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform", "${var.http_4xx_requests_extra_tags}"] +thresholds = { +warning = var.http_4xx_requests_threshold_warning +critical = var.http_4xx_requests_threshold_critical } + +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 1 +include_tags = true + +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform", var.http_4xx_requests_extra_tags] +} + diff --git a/cloud/aws/apigateway/outputs.tf b/cloud/aws/apigateway/outputs.tf index cfcce70..3c08888 100644 --- a/cloud/aws/apigateway/outputs.tf +++ b/cloud/aws/apigateway/outputs.tf @@ -1,14 +1,15 @@ output "API_Gateway_latency_id" { description = "id for monitor API_Gateway_latency" - value = "${datadog_monitor.API_Gateway_latency.*.id}" + value = datadog_monitor.API_Gateway_latency.*.id } output "API_http_5xx_errors_count_id" { description = "id for monitor API_http_5xx_errors_count" - value = "${datadog_monitor.API_http_5xx_errors_count.*.id}" + value = datadog_monitor.API_http_5xx_errors_count.*.id } output "API_http_4xx_errors_count_id" { description = "id for monitor API_http_4xx_errors_count" - value = "${datadog_monitor.API_http_4xx_errors_count.*.id}" + value = datadog_monitor.API_http_4xx_errors_count.*.id } + diff --git a/cloud/aws/apigateway/versions.tf b/cloud/aws/apigateway/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/aws/apigateway/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/aws/elasticache/common/inputs.tf b/cloud/aws/elasticache/common/inputs.tf index 6641020..6997bcf 100644 --- a/cloud/aws/elasticache/common/inputs.tf +++ b/cloud/aws/elasticache/common/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Infrastructure Environment" - type = "string" + type = string } # Global DataDog @@ -43,222 +43,223 @@ variable "filter_tags_custom_excluded" { variable "eviction_enabled" { description = "Flag to enable Elasticache eviction monitor" - type = "string" + type = string default = "true" } variable "eviction_extra_tags" { description = "Extra tags for Elasticache eviction monitor" - type = "list" + type = list(string) default = [] } variable "eviction_message" { description = "Custom message for Elasticache eviction monitor" - type = "string" + type = string default = "" } variable "eviction_timeframe" { description = "Monitor timeframe for Elasticache eviction [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } variable "eviction_threshold_warning" { description = "Elasticache free memory warning threshold in percentage" - type = "string" + type = string default = 0 } variable "eviction_threshold_critical" { description = "Elasticache free memory critical threshold in percentage" - type = "string" + type = string default = 30 } variable "max_connection_enabled" { description = "Flag to enable Elasticache max connection monitor" - type = "string" + type = string default = "true" } variable "max_connection_extra_tags" { description = "Extra tags for Elasticache max connection monitor" - type = "list" + type = list(string) default = [] } variable "max_connection_message" { description = "Custom message for Elasticache max connection monitor" - type = "string" + type = string default = "" } variable "max_connection_time_aggregator" { description = "Monitor aggregator for Elasticache max connection [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "max_connection_timeframe" { description = "Monitor timeframe for Elasticache max connection [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "no_connection_enabled" { description = "Flag to enable Elasticache no connection monitor" - type = "string" + type = string default = "true" } variable "no_connection_extra_tags" { description = "Extra tags for Elasticache no connection monitor" - type = "list" + type = list(string) default = [] } variable "no_connection_message" { description = "Custom message for Elasticache no connection monitor" - type = "string" + type = string default = "" } variable "no_connection_time_aggregator" { description = "Monitor aggregator for Elasticache no connection [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "no_connection_timeframe" { description = "Monitor timeframe for Elasticache no connection [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "swap_enabled" { description = "Flag to enable Elasticache swap monitor" - type = "string" + type = string default = "true" } variable "swap_extra_tags" { description = "Extra tags for Elasticache swap monitor" - type = "list" + type = list(string) default = [] } variable "swap_message" { description = "Custom message for Elasticache swap monitor" - type = "string" + type = string default = "" } variable "swap_time_aggregator" { description = "Monitor aggregator for Elasticache memcached swap [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "swap_timeframe" { description = "Monitor timeframe for Elasticache swap [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "swap_threshold_warning" { description = "Elasticache swap warning threshold in bytes" - type = "string" + type = string default = 0 } variable "swap_threshold_critical" { description = "Elasticache swap critical threshold in bytes" - type = "string" + type = string default = 50000000 } variable "free_memory_enabled" { description = "Flag to enable Elasticache free memory monitor" - type = "string" + type = string default = "true" } variable "free_memory_extra_tags" { description = "Extra tags for Elasticache free memory monitor" - type = "list" + type = list(string) default = [] } variable "free_memory_message" { description = "Custom message for Elasticache free memory monitor" - type = "string" + type = string default = "" } variable "free_memory_condition_timeframe" { description = "Monitor condition timeframe for Elasticache free memory [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } variable "free_memory_timeframe" { description = "Monitor timeframe for Elasticache free memory [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } variable "free_memory_threshold_warning" { description = "Elasticache free memory warning threshold in percentage" - type = "string" + type = string default = -50 } variable "free_memory_threshold_critical" { description = "Elasticache free memory critical threshold in percentage" - type = "string" + type = string default = -70 } variable "eviction_growing_enabled" { description = "Flag to enable Elasticache eviction growing monitor" - type = "string" + type = string default = "true" } variable "eviction_growing_extra_tags" { description = "Extra tags for Elasticache eviction growing monitor" - type = "list" + type = list(string) default = [] } variable "eviction_growing_message" { description = "Custom message for Elasticache eviction growing monitor" - type = "string" + type = string default = "" } variable "eviction_growing_condition_timeframe" { description = "Monitor condition timeframe for Elasticache eviction growing [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "eviction_growing_timeframe" { description = "Monitor timeframe for Elasticache eviction growing [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "eviction_growing_threshold_warning" { description = "Elasticache eviction growing warning threshold in percentage" - type = "string" + type = string default = 10 } variable "eviction_growing_threshold_critical" { description = "Elasticache eviction growing critical threshold in percentage" - type = "string" + type = string default = 30 } + diff --git a/cloud/aws/elasticache/common/modules.tf b/cloud/aws/elasticache/common/modules.tf index 081ad25..1b317be 100644 --- a/cloud/aws/elasticache/common/modules.tf +++ b/cloud/aws/elasticache/common/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "aws_elasticache" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/aws/elasticache/common/monitors-elasticache.tf b/cloud/aws/elasticache/common/monitors-elasticache.tf index 64e4ba7..284dc44 100644 --- a/cloud/aws/elasticache/common/monitors-elasticache.tf +++ b/cloud/aws/elasticache/common/monitors-elasticache.tf @@ -1,175 +1,170 @@ resource "datadog_monitor" "elasticache_eviction" { - count = "${var.eviction_enabled == "true" ? 1 : 0}" + count = var.eviction_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache eviction {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}" - message = "${coalesce(var.eviction_message, var.message)}" - + message = coalesce(var.eviction_message, var.message) type = "query alert" query = < ${var.eviction_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.eviction_threshold_warning}" - critical = "${var.eviction_threshold_critical}" + thresholds = { + warning = var.eviction_threshold_warning + critical = var.eviction_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.eviction_extra_tags}"] + 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" { - count = "${var.max_connection_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache max connections reached {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" - message = "${coalesce(var.max_connection_message, var.message)}" - + count = var.max_connection_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache max connections reached {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" + message = coalesce(var.max_connection_message, var.message) type = "query alert" query = <= 65000 - EOQ +EOQ - notify_no_data = true - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = true +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.max_connection_extra_tags}"] +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" { - count = "${var.no_connection_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache connections {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" - message = "${coalesce(var.no_connection_message, var.message)}" +count = var.no_connection_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache connections {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" +message = coalesce(var.no_connection_message, var.message) +type = "query alert" - type = "query alert" - - query = < ${var.swap_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.swap_threshold_warning}" - critical = "${var.swap_threshold_critical}" + thresholds = { + warning = var.swap_threshold_warning + critical = var.swap_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.swap_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", var.swap_extra_tags] } resource "datadog_monitor" "elasticache_free_memory" { - count = "${var.free_memory_enabled == "true" ? 1 : 0}" + count = var.free_memory_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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)}" - + message = coalesce(var.free_memory_message, var.message) type = "query alert" query = < ${var.eviction_growing_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.eviction_growing_threshold_warning}" - critical = "${var.eviction_growing_threshold_critical}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", "${var.eviction_growing_extra_tags}"] +thresholds = { +warning = var.eviction_growing_threshold_warning +critical = var.eviction_growing_threshold_critical } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false + +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/common/outputs.tf b/cloud/aws/elasticache/common/outputs.tf index 5268c4d..2dbc16a 100644 --- a/cloud/aws/elasticache/common/outputs.tf +++ b/cloud/aws/elasticache/common/outputs.tf @@ -1,29 +1,30 @@ output "elasticache_eviction_id" { description = "id for monitor elasticache_eviction" - value = "${datadog_monitor.elasticache_eviction.*.id}" + value = datadog_monitor.elasticache_eviction.*.id } output "elasticache_max_connection_id" { description = "id for monitor elasticache_max_connection" - value = "${datadog_monitor.elasticache_max_connection.*.id}" + value = datadog_monitor.elasticache_max_connection.*.id } output "elasticache_no_connection_id" { description = "id for monitor elasticache_no_connection" - value = "${datadog_monitor.elasticache_no_connection.*.id}" + value = datadog_monitor.elasticache_no_connection.*.id } output "elasticache_swap_id" { description = "id for monitor elasticache_swap" - value = "${datadog_monitor.elasticache_swap.*.id}" + value = datadog_monitor.elasticache_swap.*.id } output "elasticache_free_memory_id" { description = "id for monitor elasticache_free_memory" - value = "${datadog_monitor.elasticache_free_memory.*.id}" + value = datadog_monitor.elasticache_free_memory.*.id } output "elasticache_eviction_growing_id" { description = "id for monitor elasticache_eviction_growing" - value = "${datadog_monitor.elasticache_eviction_growing.*.id}" + value = datadog_monitor.elasticache_eviction_growing.*.id } + diff --git a/cloud/aws/elasticache/common/versions.tf b/cloud/aws/elasticache/common/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/aws/elasticache/common/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/aws/elasticache/memcached/inputs.tf b/cloud/aws/elasticache/memcached/inputs.tf index b0cca66..25b63a4 100644 --- a/cloud/aws/elasticache/memcached/inputs.tf +++ b/cloud/aws/elasticache/memcached/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Infrastructure Environment" - type = "string" + type = string } # Global DataDog @@ -43,84 +43,85 @@ variable "filter_tags_custom_excluded" { variable "get_hits_enabled" { description = "Flag to enable Elasticache memcached get hits monitor" - type = "string" + type = string default = "true" } variable "get_hits_extra_tags" { description = "Extra tags for Elasticache memcached get hits monitor" - type = "list" + type = list(string) default = [] } variable "get_hits_message" { description = "Custom message for Elasticache memcached get hits monitor" - type = "string" + type = string default = "" } variable "get_hits_time_aggregator" { description = "Monitor aggregator for Elasticache memcached get hits [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "get_hits_timeframe" { description = "Monitor timeframe for Elasticache memcached get hits [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } variable "get_hits_threshold_warning" { description = "Elasticache memcached get hits warning threshold in percentage" - type = "string" + type = string default = 80 } variable "get_hits_threshold_critical" { description = "Elasticache memcached get hits critical threshold in percentage" - type = "string" + type = string default = 60 } variable "cpu_high_enabled" { description = "Flag to enable Elasticache memcached cpu high monitor" - type = "string" + type = string default = "true" } variable "cpu_high_extra_tags" { description = "Extra tags for Elasticache memcached cpu high monitor" - type = "list" + type = list(string) default = [] } variable "cpu_high_message" { description = "Custom message for Elasticache memcached cpu high monitor" - type = "string" + type = string default = "" } variable "cpu_high_time_aggregator" { description = "Monitor aggregator for Elasticache memcached cpu high [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cpu_high_timeframe" { description = "Monitor timeframe for Elasticache memcached cpu high [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } variable "cpu_high_threshold_warning" { description = "Elasticache memcached cpu high warning threshold in percentage" - type = "string" + type = string default = 75 } variable "cpu_high_threshold_critical" { description = "Elasticache memcached cpu high critical threshold in percentage" - type = "string" + type = string default = 90 } + diff --git a/cloud/aws/elasticache/memcached/modules.tf b/cloud/aws/elasticache/memcached/modules.tf index 081ad25..1b317be 100644 --- a/cloud/aws/elasticache/memcached/modules.tf +++ b/cloud/aws/elasticache/memcached/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "aws_elasticache" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/aws/elasticache/memcached/monitors-memcached.tf b/cloud/aws/elasticache/memcached/monitors-memcached.tf index 07839b1..3006253 100644 --- a/cloud/aws/elasticache/memcached/monitors-memcached.tf +++ b/cloud/aws/elasticache/memcached/monitors-memcached.tf @@ -1,7 +1,7 @@ resource "datadog_monitor" "memcached_get_hits" { - count = "${var.get_hits_enabled == "true" ? 1 : 0}" + count = var.get_hits_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache memcached cache hit ratio {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.get_hits_message, var.message)}" + message = coalesce(var.get_hits_message, var.message) type = "query alert" @@ -11,30 +11,30 @@ resource "datadog_monitor" "memcached_get_hits" { default(avg:aws.elasticache.get_hits${module.filter-tags.query_alert} by {region,cacheclusterid,cachenodeid}.as_rate(), 0) + default(avg:aws.elasticache.get_misses${module.filter-tags.query_alert} by {region,cacheclusterid,cachenodeid}.as_rate(), 0)) ) * 100 < ${var.get_hits_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.get_hits_threshold_warning}" - critical = "${var.get_hits_threshold_critical}" + thresholds = { + warning = var.get_hits_threshold_warning + critical = var.get_hits_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached", "${var.get_hits_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached", var.get_hits_extra_tags] } resource "datadog_monitor" "memcached_cpu_high" { - count = "${var.cpu_high_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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)}" + count = var.cpu_high_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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) type = "query alert" @@ -42,22 +42,23 @@ resource "datadog_monitor" "memcached_cpu_high" { ${var.cpu_high_time_aggregator}(${var.cpu_high_timeframe}): ( avg:aws.elasticache.cpuutilization${module.filter-tags.query_alert} by {region,cacheclusterid,cachenodeid} ) > ${var.cpu_high_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.cpu_high_threshold_warning}" - critical = "${var.cpu_high_threshold_critical}" - } - - notify_no_data = true - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached", "${var.cpu_high_extra_tags}"] +thresholds = { +warning = var.cpu_high_threshold_warning +critical = var.cpu_high_threshold_critical } + +notify_no_data = true +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached", var.cpu_high_extra_tags] +} + diff --git a/cloud/aws/elasticache/memcached/outputs.tf b/cloud/aws/elasticache/memcached/outputs.tf index 7beb0d5..68b8ada 100644 --- a/cloud/aws/elasticache/memcached/outputs.tf +++ b/cloud/aws/elasticache/memcached/outputs.tf @@ -1,9 +1,10 @@ output "memcached_get_hits_id" { description = "id for monitor memcached_get_hits" - value = "${datadog_monitor.memcached_get_hits.*.id}" + value = datadog_monitor.memcached_get_hits.*.id } output "memcached_cpu_high_id" { description = "id for monitor memcached_cpu_high" - value = "${datadog_monitor.memcached_cpu_high.*.id}" + value = datadog_monitor.memcached_cpu_high.*.id } + diff --git a/cloud/aws/elasticache/memcached/versions.tf b/cloud/aws/elasticache/memcached/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/aws/elasticache/memcached/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/aws/elasticache/redis/inputs.tf b/cloud/aws/elasticache/redis/inputs.tf index d17347a..ed61e74 100644 --- a/cloud/aws/elasticache/redis/inputs.tf +++ b/cloud/aws/elasticache/redis/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Infrastructure Environment" - type = "string" + type = string } # Global DataDog @@ -43,150 +43,151 @@ variable "filter_tags_custom_excluded" { variable "cache_hits_enabled" { description = "Flag to enable Elasticache redis cache hits monitor" - type = "string" + type = string default = "true" } variable "cache_hits_extra_tags" { description = "Extra tags for Elasticache redis cache hits monitor" - type = "list" + type = list(string) default = [] } variable "cache_hits_message" { description = "Custom message for Elasticache redis cache hits monitor" - type = "string" + type = string default = "" } variable "cache_hits_time_aggregator" { description = "Monitor aggregator for Elasticache redis cache hits [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "cache_hits_timeframe" { description = "Monitor timeframe for Elasticache redis cache hits [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } variable "cache_hits_threshold_warning" { description = "Elasticache redis cache hits warning threshold in percentage" - type = "string" + type = string default = 80 } variable "cache_hits_threshold_critical" { description = "Elasticache redis cache hits critical threshold in percentage" - type = "string" + type = string default = 60 } variable "cpu_high_enabled" { description = "Flag to enable Elasticache redis cpu high monitor" - type = "string" + type = string default = "true" } variable "cpu_high_extra_tags" { description = "Extra tags for Elasticache redis cpu high monitor" - type = "list" + type = list(string) default = [] } variable "cpu_high_message" { description = "Custom message for Elasticache redis cpu high monitor" - type = "string" + type = string default = "" } variable "cpu_high_time_aggregator" { description = "Monitor aggregator for Elasticache redis cpu high [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cpu_high_timeframe" { description = "Monitor timeframe for Elasticache redis cpu high [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } variable "cpu_high_threshold_warning" { description = "Elasticache redis cpu high warning threshold in percentage" - type = "string" + type = string default = 75 } variable "cpu_high_threshold_critical" { description = "Elasticache redis cpu high critical threshold in percentage" - type = "string" + type = string default = 90 } variable "replication_lag_enabled" { description = "Flag to enable Elasticache redis replication lag monitor" - type = "string" + type = string default = "true" } variable "replication_lag_extra_tags" { description = "Extra tags for Elasticache redis replication lag monitor" - type = "list" + type = list(string) default = [] } variable "replication_lag_message" { description = "Custom message for Elasticache redis replication lag monitor" - type = "string" + type = string default = "" } variable "replication_lag_time_aggregator" { description = "Monitor aggregator for Elasticache redis replication lag [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "replication_lag_timeframe" { description = "Monitor timeframe for Elasticache redis replication lag [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_10m" } variable "replication_lag_threshold_warning" { description = "Elasticache redis replication lag warning threshold in seconds" - type = "string" + type = string default = 90 } variable "replication_lag_threshold_critical" { description = "Elasticache redis replication lag critical threshold in seconds" - type = "string" + type = string default = 180 } variable "commands_enabled" { description = "Flag to enable Elasticache redis commands monitor" - type = "string" + type = string default = "true" } variable "commands_extra_tags" { description = "Extra tags for Elasticache redis commands monitor" - type = "list" + type = list(string) default = [] } variable "commands_message" { description = "Custom message for Elasticache redis commands monitor" - type = "string" + type = string default = "" } variable "commands_timeframe" { description = "Monitor timeframe for Elasticache redis commands [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } + diff --git a/cloud/aws/elasticache/redis/modules.tf b/cloud/aws/elasticache/redis/modules.tf index 081ad25..1b317be 100644 --- a/cloud/aws/elasticache/redis/modules.tf +++ b/cloud/aws/elasticache/redis/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "aws_elasticache" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/aws/elasticache/redis/monitors-redis.tf b/cloud/aws/elasticache/redis/monitors-redis.tf index 6489660..479d414 100644 --- a/cloud/aws/elasticache/redis/monitors-redis.tf +++ b/cloud/aws/elasticache/redis/monitors-redis.tf @@ -1,7 +1,7 @@ resource "datadog_monitor" "redis_cache_hits" { - count = "${var.cache_hits_enabled == "true" ? 1 : 0}" + count = var.cache_hits_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis cache hit ratio {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cache_hits_message, var.message)}" + message = coalesce(var.cache_hits_message, var.message) type = "query alert" @@ -11,30 +11,30 @@ resource "datadog_monitor" "redis_cache_hits" { avg:aws.elasticache.cache_hits${module.filter-tags.query_alert} by {region,cacheclusterid,cachenodeid}.as_rate() + avg:aws.elasticache.cache_misses${module.filter-tags.query_alert} by {region,cacheclusterid,cachenodeid}.as_rate()) * 100, 100) < ${var.cache_hits_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.cache_hits_threshold_warning}" - critical = "${var.cache_hits_threshold_critical}" + thresholds = { + warning = var.cache_hits_threshold_warning + critical = var.cache_hits_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", "${var.cache_hits_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", var.cache_hits_extra_tags] } resource "datadog_monitor" "redis_cpu_high" { - count = "${var.cpu_high_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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)}" + count = var.cpu_high_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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) type = "query alert" @@ -42,75 +42,76 @@ resource "datadog_monitor" "redis_cpu_high" { ${var.cpu_high_time_aggregator}(${var.cpu_high_timeframe}): ( avg:aws.elasticache.engine_cpuutilization${module.filter-tags.query_alert} by {region,cacheclusterid,cachenodeid} ) > ${var.cpu_high_threshold_critical} - EOQ +EOQ - notify_no_data = true - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" +notify_no_data = true +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", "${var.cpu_high_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", var.cpu_high_extra_tags] } resource "datadog_monitor" "redis_replication_lag" { - count = "${var.replication_lag_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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)}" +count = var.replication_lag_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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) type = "query alert" - query = < ${var.replication_lag_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.replication_lag_threshold_warning}" - critical = "${var.replication_lag_threshold_critical}" - } +thresholds = { +warning = var.replication_lag_threshold_warning +critical = var.replication_lag_threshold_critical +} - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", "${var.replication_lag_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", var.replication_lag_extra_tags] } resource "datadog_monitor" "redis_commands" { - count = "${var.commands_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis is receiving no commands" - message = "${coalesce(var.commands_message, var.message)}" +count = var.commands_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis is receiving no commands" +message = coalesce(var.commands_message, var.message) type = "query alert" - query = < 1 < query value (=1.1) < 2 : warning Workaround : in the query, we add "0.1" to the result and we use the comparator ">=". No alert was triggered without that. */ resource "datadog_monitor" "es_cluster_status" { - count = "${var.es_cluster_status_enabled == "true" ? 1 : 0}" + count = var.es_cluster_status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch cluster status is not green" - message = "${coalesce(var.es_cluster_status_message, var.message)}" - + message = coalesce(var.es_cluster_status_message, var.message) type = "query alert" query = <= 2 - EOQ +EOQ - thresholds { - warning = 1 + thresholds = { + warning = 1 critical = 2 } - notify_no_data = true - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = true + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform", "${var.es_cluster_status_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform", var.es_cluster_status_extra_tags] } ### Elasticsearch cluster free storage space monitor ### resource "datadog_monitor" "es_free_space_low" { - count = "${var.diskspace_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch cluster free storage space {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.diskspace_message, var.message)}" - + count = var.diskspace_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch cluster free storage space {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.diskspace_message, var.message) type = "query alert" query = < ${var.cpu_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.cpu_threshold_warning}" - critical = "${var.cpu_threshold_critical}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform", "${var.cpu_extra_tags}"] +thresholds = { +warning = var.cpu_threshold_warning +critical = var.cpu_threshold_critical } + +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform", var.cpu_extra_tags] +} + diff --git a/cloud/aws/elasticsearch/outputs.tf b/cloud/aws/elasticsearch/outputs.tf index dc12393..602541e 100644 --- a/cloud/aws/elasticsearch/outputs.tf +++ b/cloud/aws/elasticsearch/outputs.tf @@ -1,14 +1,15 @@ output "es_cluster_status_id" { description = "id for monitor es_cluster_status" - value = "${datadog_monitor.es_cluster_status.*.id}" + value = datadog_monitor.es_cluster_status.*.id } output "es_free_space_low_id" { description = "id for monitor es_free_space_low" - value = "${datadog_monitor.es_free_space_low.*.id}" + value = datadog_monitor.es_free_space_low.*.id } output "es_cpu_90_15min_id" { description = "id for monitor es_cpu_90_15min" - value = "${datadog_monitor.es_cpu_90_15min.*.id}" + value = datadog_monitor.es_cpu_90_15min.*.id } + diff --git a/cloud/aws/elasticsearch/versions.tf b/cloud/aws/elasticsearch/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/aws/elasticsearch/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/aws/elb/inputs.tf b/cloud/aws/elb/inputs.tf index 08ce711..014fdc5 100644 --- a/cloud/aws/elb/inputs.tf +++ b/cloud/aws/elb/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -43,55 +43,55 @@ variable "filter_tags_custom_excluded" { variable "elb_no_healthy_instance_enabled" { description = "Flag to enable ELB no healty instance monitor" - type = "string" + type = string default = "true" } variable "elb_no_healthy_instance_extra_tags" { description = "Extra tags for ELB no healty instance monitor" - type = "list" + type = list(string) default = [] } variable "elb_no_healthy_instance_message" { description = "Custom message for ELB no healty instance monitor" - type = "string" + type = string default = "" } variable "elb_no_healthy_instance_time_aggregator" { description = "Monitor aggregator for ELB no healty instance [available values: min or max]" - type = "string" + type = string default = "min" } variable "elb_no_healthy_instance_timeframe" { description = "Monitor timeframe for ELB no healty instance [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "elb_4xx_enabled" { description = "Flag to enable ELB 4xx errors monitor" - type = "string" + type = string default = "true" } variable "elb_4xx_extra_tags" { description = "Extra tags for ELB 4xx errors monitor" - type = "list" + type = list(string) default = [] } variable "elb_4xx_message" { description = "Custom message for ELB 4xx errors monitor" - type = "string" + type = string default = "" } variable "elb_4xx_timeframe" { description = "Monitor timeframe for ELB 4xx errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -107,25 +107,25 @@ variable "elb_4xx_threshold_critical" { variable "elb_5xx_enabled" { description = "Flag to enable ELB 5xx errors monitor" - type = "string" + type = string default = "true" } variable "elb_5xx_extra_tags" { description = "Extra tags for ELB 5xx errors monitor" - type = "list" + type = list(string) default = [] } variable "elb_5xx_message" { description = "Custom message for ELB 5xx errors monitor" - type = "string" + type = string default = "" } variable "elb_5xx_timeframe" { description = "Monitor timeframe for ELB 5xx errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -141,25 +141,25 @@ variable "elb_5xx_threshold_critical" { variable "elb_backend_4xx_enabled" { description = "Flag to enable ELB backend 4xx errors monitor" - type = "string" + type = string default = "true" } variable "elb_backend_4xx_extra_tags" { description = "Extra tags for ELB backend 4xx errors monitor" - type = "list" + type = list(string) default = [] } variable "elb_backend_4xx_message" { description = "Custom message for ELB backend 4xx errors monitor" - type = "string" + type = string default = "" } variable "elb_backend_4xx_timeframe" { description = "Monitor timeframe for ELB backend 4xx errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -175,25 +175,25 @@ variable "elb_backend_4xx_threshold_critical" { variable "elb_backend_5xx_enabled" { description = "Flag to enable ELB backend 5xx errors monitor" - type = "string" + type = string default = "true" } variable "elb_backend_5xx_extra_tags" { description = "Extra tags for ELB backend 5xx errors monitor" - type = "list" + type = list(string) default = [] } variable "elb_backend_5xx_message" { description = "Custom message for ELB backend 5xx errors monitor" - type = "string" + type = string default = "" } variable "elb_backend_5xx_timeframe" { description = "Monitor timeframe for ELB backend 5xx errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -209,31 +209,31 @@ variable "elb_backend_5xx_threshold_critical" { variable "elb_backend_latency_enabled" { description = "Flag to enable ELB backend latency monitor" - type = "string" + type = string default = "true" } variable "elb_backend_latency_extra_tags" { description = "Extra tags for ELB backend latency monitor" - type = "list" + type = list(string) default = [] } variable "elb_backend_latency_message" { description = "Custom message for ELB backend latency monitor" - type = "string" + type = string default = "" } variable "elb_backend_latency_time_aggregator" { description = "Monitor aggregator for ELB backend latency [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "elb_backend_latency_timeframe" { description = "Monitor timeframe for ELB backend latency [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -251,3 +251,4 @@ variable "artificial_requests_count" { default = 5 description = "Number of false requests used to mitigate false positive in case of low trafic" } + diff --git a/cloud/aws/elb/modules.tf b/cloud/aws/elb/modules.tf index b6ad8ae..9d396f6 100644 --- a/cloud/aws/elb/modules.tf +++ b/cloud/aws/elb/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "aws_elb" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/aws/elb/monitors-elb.tf b/cloud/aws/elb/monitors-elb.tf index 04bc028..310cf10 100644 --- a/cloud/aws/elb/monitors-elb.tf +++ b/cloud/aws/elb/monitors-elb.tf @@ -1,7 +1,8 @@ resource "datadog_monitor" "ELB_no_healthy_instances" { - count = "${var.elb_no_healthy_instance_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB healthy instances {{#is_alert}}is at 0{{/is_alert}}{{#is_warning}}is at {{value}}%{{/is_warning}}" - message = "${coalesce(var.elb_no_healthy_instance_message, var.message)}" + count = var.elb_no_healthy_instance_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB healthy instances {{#is_alert}}is at 0{{/is_alert}}{{#is_warning}}is at {{value}}%%{{/is_warning}}" + message = coalesce(var.elb_no_healthy_instance_message, var.message) + type = "query alert" query = < ${var.elb_4xx_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.elb_4xx_threshold_warning +critical = var.elb_4xx_threshold_critical +} - thresholds { - warning = "${var.elb_4xx_threshold_warning}" - critical = "${var.elb_4xx_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", "${var.elb_4xx_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_4xx_extra_tags] } resource "datadog_monitor" "ELB_too_much_5xx" { - count = "${var.elb_5xx_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.elb_5xx_message, var.message)}" +count = var.elb_5xx_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.elb_5xx_message, var.message) + type = "query alert" - query = < ${var.elb_5xx_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.elb_5xx_threshold_warning +critical = var.elb_5xx_threshold_critical +} - thresholds { - warning = "${var.elb_5xx_threshold_warning}" - critical = "${var.elb_5xx_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", "${var.elb_5xx_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_5xx_extra_tags] } resource "datadog_monitor" "ELB_too_much_4xx_backend" { - count = "${var.elb_backend_4xx_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB backend 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.elb_backend_4xx_message, var.message)}" +count = var.elb_backend_4xx_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB backend 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.elb_backend_4xx_message, var.message) + type = "query alert" - query = < ${var.elb_backend_4xx_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.elb_backend_4xx_threshold_warning}" - critical = "${var.elb_backend_4xx_threshold_critical}" + thresholds = { + warning = var.elb_backend_4xx_threshold_warning + critical = var.elb_backend_4xx_threshold_critical } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", "${var.elb_backend_4xx_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_backend_4xx_extra_tags] } resource "datadog_monitor" "ELB_too_much_5xx_backend" { - count = "${var.elb_backend_5xx_enabled == "true" ? 1 : 0}" + count = var.elb_backend_5xx_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB backend 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.elb_backend_5xx_message, var.message)}" + message = coalesce(var.elb_backend_5xx_message, var.message) + type = "query alert" query = < ${var.elb_backend_5xx_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.elb_backend_5xx_threshold_warning}" - critical = "${var.elb_backend_5xx_threshold_critical}" + thresholds = { + warning = var.elb_backend_5xx_threshold_warning + critical = var.elb_backend_5xx_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", "${var.elb_backend_5xx_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_backend_5xx_extra_tags] } resource "datadog_monitor" "ELB_backend_latency" { - count = "${var.elb_backend_latency_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB latency too high {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" - message = "${coalesce(var.elb_backend_latency_message, var.message)}" + count = var.elb_backend_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB latency too high {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" + message = coalesce(var.elb_backend_latency_message, var.message) + type = "query alert" query = < ${var.elb_backend_latency_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.elb_backend_latency_warning}" - critical = "${var.elb_backend_latency_critical}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", "${var.elb_backend_latency_extra_tags}"] +thresholds = { +warning = var.elb_backend_latency_warning +critical = var.elb_backend_latency_critical } + +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_backend_latency_extra_tags] +} + diff --git a/cloud/aws/elb/outputs.tf b/cloud/aws/elb/outputs.tf index d657bc4..8b115d2 100644 --- a/cloud/aws/elb/outputs.tf +++ b/cloud/aws/elb/outputs.tf @@ -1,29 +1,30 @@ output "ELB_no_healthy_instances_id" { description = "id for monitor ELB_no_healthy_instances" - value = "${datadog_monitor.ELB_no_healthy_instances.*.id}" + value = datadog_monitor.ELB_no_healthy_instances.*.id } output "ELB_too_much_4xx_id" { description = "id for monitor ELB_too_much_4xx" - value = "${datadog_monitor.ELB_too_much_4xx.*.id}" + value = datadog_monitor.ELB_too_much_4xx.*.id } output "ELB_too_much_5xx_id" { description = "id for monitor ELB_too_much_5xx" - value = "${datadog_monitor.ELB_too_much_5xx.*.id}" + value = datadog_monitor.ELB_too_much_5xx.*.id } output "ELB_too_much_4xx_backend_id" { description = "id for monitor ELB_too_much_4xx_backend" - value = "${datadog_monitor.ELB_too_much_4xx_backend.*.id}" + value = datadog_monitor.ELB_too_much_4xx_backend.*.id } output "ELB_too_much_5xx_backend_id" { description = "id for monitor ELB_too_much_5xx_backend" - value = "${datadog_monitor.ELB_too_much_5xx_backend.*.id}" + value = datadog_monitor.ELB_too_much_5xx_backend.*.id } output "ELB_backend_latency_id" { description = "id for monitor ELB_backend_latency" - value = "${datadog_monitor.ELB_backend_latency.*.id}" + value = datadog_monitor.ELB_backend_latency.*.id } + diff --git a/cloud/aws/elb/versions.tf b/cloud/aws/elb/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/aws/elb/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/aws/kinesis-firehose/inputs.tf b/cloud/aws/kinesis-firehose/inputs.tf index 3e60557..5fbd2a3 100644 --- a/cloud/aws/kinesis-firehose/inputs.tf +++ b/cloud/aws/kinesis-firehose/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Environment" - type = "string" + type = string } # Global DataDog @@ -43,19 +43,19 @@ variable "filter_tags_custom_excluded" { variable "incoming_records_enabled" { description = "Flag to enable Kinesis Firehorse incoming records monitor" - type = "string" + type = string default = "true" } variable "incoming_records_extra_tags" { description = "Extra tags for Kinesis Firehorse incoming records monitor" - type = "list" + type = list(string) default = [] } variable "incoming_records_message" { description = "Custom message for Kinesis Firehorse incoming records monitor" - type = "string" + type = string default = "" } @@ -63,3 +63,4 @@ variable "incoming_records_timeframe" { description = "Monitor timeframe for incoming records metrics evaluation [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" default = "last_15m" } + diff --git a/cloud/aws/kinesis-firehose/modules.tf b/cloud/aws/kinesis-firehose/modules.tf index f3a1d71..f9113f5 100644 --- a/cloud/aws/kinesis-firehose/modules.tf +++ b/cloud/aws/kinesis-firehose/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "aws_kinesis-firehose" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf b/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf index 633e22a..8c6cbbd 100644 --- a/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf +++ b/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf @@ -1,30 +1,30 @@ ### Kinesis Firehose Incoming records ### resource "datadog_monitor" "firehose_incoming_records" { - count = "${var.incoming_records_enabled == "true" ? 1 : 0}" + count = var.incoming_records_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kinesis Firehose No incoming records" - message = "${coalesce(var.incoming_records_message, var.message)}" - + message = coalesce(var.incoming_records_message, var.message) type = "query alert" query = < ${var.aurora_replicalag_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.aurora_replicalag_threshold_warning}" - critical = "${var.aurora_replicalag_threshold_critical}" + thresholds = { + warning = var.aurora_replicalag_threshold_warning + critical = var.aurora_replicalag_threshold_critical } - notify_no_data = true - evaluation_delay = "${var.evaluation_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = true + evaluation_delay = var.evaluation_delay + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-mysql", "team:claranet", "created-by:terraform", "${var.aurora_replicalag_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-mysql", "team:claranet", "created-by:terraform", var.aurora_replicalag_extra_tags] } + diff --git a/cloud/aws/rds/aurora/mysql/outputs.tf b/cloud/aws/rds/aurora/mysql/outputs.tf index dd13b44..f94f46d 100644 --- a/cloud/aws/rds/aurora/mysql/outputs.tf +++ b/cloud/aws/rds/aurora/mysql/outputs.tf @@ -1,4 +1,5 @@ output "rds_aurora_mysql_replica_lag_id" { description = "id for monitor rds_aurora_mysql_replica_lag" - value = "${datadog_monitor.rds_aurora_mysql_replica_lag.*.id}" + value = datadog_monitor.rds_aurora_mysql_replica_lag.*.id } + diff --git a/cloud/aws/rds/aurora/mysql/versions.tf b/cloud/aws/rds/aurora/mysql/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/aws/rds/aurora/mysql/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/aws/rds/aurora/postgresql/inputs.tf b/cloud/aws/rds/aurora/postgresql/inputs.tf index 6b07522..d8ebf55 100644 --- a/cloud/aws/rds/aurora/postgresql/inputs.tf +++ b/cloud/aws/rds/aurora/postgresql/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -43,25 +43,25 @@ variable "filter_tags_custom_excluded" { variable "aurora_replicalag_enabled" { description = "Flag to enable RDS Aurora replica lag monitor" - type = "string" + type = string default = "true" } variable "aurora_replicalag_extra_tags" { description = "Extra tags for RDS Aurora replica lag monitor" - type = "list" + type = list(string) default = [] } variable "aurora_replicalag_message" { description = "Custom message for RDS Aurora replica lag monitor" - type = "string" + type = string default = "" } variable "aurora_replicalag_timeframe" { description = "Monitor timeframe for RDS Aurora replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -74,3 +74,4 @@ variable "aurora_replicalag_threshold_critical" { description = "Aurora replica lag in milliseconds (critical threshold)" default = "200" } + diff --git a/cloud/aws/rds/aurora/postgresql/modules.tf b/cloud/aws/rds/aurora/postgresql/modules.tf index e40637d..a5459e6 100644 --- a/cloud/aws/rds/aurora/postgresql/modules.tf +++ b/cloud/aws/rds/aurora/postgresql/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "aws_rds" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf b/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf index e97638e..a29f0b9 100644 --- a/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf +++ b/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf @@ -1,30 +1,30 @@ ### RDS Aurora Postgresql Replica Lag monitor ### resource "datadog_monitor" "rds_aurora_postgresql_replica_lag" { - count = "${var.aurora_replicalag_enabled == "true" ? 1 : 0}" + count = var.aurora_replicalag_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] RDS Aurora PostgreSQL replica lag {{#is_alert}}{{{comparator}}} {{threshold}} ms ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ms ({{value}}%){{/is_warning}}" - message = "${coalesce(var.aurora_replicalag_message, var.message)}" - + message = coalesce(var.aurora_replicalag_message, var.message) type = "query alert" query = < ${var.aurora_replicalag_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.aurora_replicalag_threshold_warning}" - critical = "${var.aurora_replicalag_threshold_critical}" + thresholds = { + warning = var.aurora_replicalag_threshold_warning + critical = var.aurora_replicalag_threshold_critical } - notify_no_data = true - evaluation_delay = "${var.evaluation_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = true + evaluation_delay = var.evaluation_delay + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-postgresql", "team:claranet", "created-by:terraform", "${var.aurora_replicalag_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-postgresql", "team:claranet", "created-by:terraform", var.aurora_replicalag_extra_tags] } + diff --git a/cloud/aws/rds/aurora/postgresql/outputs.tf b/cloud/aws/rds/aurora/postgresql/outputs.tf index b88c1c4..118d6bb 100644 --- a/cloud/aws/rds/aurora/postgresql/outputs.tf +++ b/cloud/aws/rds/aurora/postgresql/outputs.tf @@ -1,4 +1,5 @@ output "rds_aurora_postgresql_replica_lag_id" { description = "id for monitor rds_aurora_postgresql_replica_lag" - value = "${datadog_monitor.rds_aurora_postgresql_replica_lag.*.id}" + value = datadog_monitor.rds_aurora_postgresql_replica_lag.*.id } + diff --git a/cloud/aws/rds/aurora/postgresql/versions.tf b/cloud/aws/rds/aurora/postgresql/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/aws/rds/aurora/postgresql/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/aws/rds/common/inputs.tf b/cloud/aws/rds/common/inputs.tf index 89c996d..f7e0796 100644 --- a/cloud/aws/rds/common/inputs.tf +++ b/cloud/aws/rds/common/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -43,31 +43,31 @@ variable "filter_tags_custom_excluded" { variable "cpu_enabled" { description = "Flag to enable RDS CPU usage monitor" - type = "string" + type = string default = "true" } variable "cpu_extra_tags" { description = "Extra tags for RDS CPU usage monitor" - type = "list" + type = list(string) default = [] } variable "cpu_message" { description = "Custom message for RDS CPU usage monitor" - type = "string" + type = string default = "" } variable "cpu_time_aggregator" { description = "Monitor aggregator for RDS CPU usage [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cpu_timeframe" { description = "Monitor timeframe for RDS CPU usage [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -83,31 +83,31 @@ variable "cpu_threshold_critical" { variable "diskspace_enabled" { description = "Flag to enable RDS free diskspace monitor" - type = "string" + type = string default = "true" } variable "diskspace_extra_tags" { description = "Extra tags for RDS free diskspace monitor" - type = "list" + type = list(string) default = [] } variable "diskspace_message" { description = "Custom message for RDS free diskspace monitor" - type = "string" + type = string default = "" } variable "diskspace_time_aggregator" { description = "Monitor aggregator for RDS free diskspace [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "diskspace_timeframe" { description = "Monitor timeframe for RDS free diskspace [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -123,25 +123,25 @@ variable "diskspace_threshold_critical" { variable "replicalag_enabled" { description = "Flag to enable RDS replica lag monitor" - type = "string" + type = string default = "true" } variable "replicalag_extra_tags" { description = "Extra tags for RDS replica lag monitor" - type = "list" + type = list(string) default = [] } variable "replicalag_message" { description = "Custom message for RDS replica lag monitor" - type = "string" + type = string default = "" } variable "replicalag_timeframe" { description = "Monitor timeframe for RDS replica lag monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -154,3 +154,4 @@ variable "replicalag_threshold_critical" { description = "replica lag in seconds (critical threshold)" default = "300" } + diff --git a/cloud/aws/rds/common/modules.tf b/cloud/aws/rds/common/modules.tf index 20f58c5..62fbd46 100644 --- a/cloud/aws/rds/common/modules.tf +++ b/cloud/aws/rds/common/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "aws_rds" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/aws/rds/common/monitors-rds-common.tf b/cloud/aws/rds/common/monitors-rds-common.tf index 098d6e6..fb526fa 100644 --- a/cloud/aws/rds/common/monitors-rds-common.tf +++ b/cloud/aws/rds/common/monitors-rds-common.tf @@ -1,40 +1,38 @@ ### RDS instance CPU monitor ### resource "datadog_monitor" "rds_cpu_90_15min" { - count = "${var.cpu_enabled == "true" ? 1 : 0}" + count = var.cpu_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] RDS instance CPU high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cpu_message, var.message)}" - + message = coalesce(var.cpu_message, var.message) type = "query alert" query = < ${var.cpu_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.cpu_threshold_warning}" - critical = "${var.cpu_threshold_critical}" + thresholds = { + warning = var.cpu_threshold_warning + critical = var.cpu_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", "${var.cpu_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", var.cpu_extra_tags] } ### RDS instance free space monitor ### resource "datadog_monitor" "rds_free_space_low" { - count = "${var.diskspace_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] RDS instance free space {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.diskspace_message, var.message)}" - + count = var.diskspace_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] RDS instance free space {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.diskspace_message, var.message) type = "query alert" query = < ${var.replicalag_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.replicalag_threshold_warning}" - critical = "${var.replicalag_threshold_critical}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", "${var.replicalag_extra_tags}"] +thresholds = { +warning = var.replicalag_threshold_warning +critical = var.replicalag_threshold_critical } + +notify_no_data = false +evaluation_delay = var.evaluation_delay +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", var.replicalag_extra_tags] +} + diff --git a/cloud/aws/rds/common/outputs.tf b/cloud/aws/rds/common/outputs.tf index e112047..e70b9b6 100644 --- a/cloud/aws/rds/common/outputs.tf +++ b/cloud/aws/rds/common/outputs.tf @@ -1,14 +1,15 @@ output "rds_cpu_90_15min_id" { description = "id for monitor rds_cpu_90_15min" - value = "${datadog_monitor.rds_cpu_90_15min.*.id}" + value = datadog_monitor.rds_cpu_90_15min.*.id } output "rds_free_space_low_id" { description = "id for monitor rds_free_space_low" - value = "${datadog_monitor.rds_free_space_low.*.id}" + value = datadog_monitor.rds_free_space_low.*.id } output "rds_replica_lag_id" { description = "id for monitor rds_replica_lag" - value = "${datadog_monitor.rds_replica_lag.*.id}" + value = datadog_monitor.rds_replica_lag.*.id } + diff --git a/cloud/aws/rds/common/versions.tf b/cloud/aws/rds/common/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/aws/rds/common/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/aws/vpn/inputs.tf b/cloud/aws/vpn/inputs.tf index 2994bd3..b29e56c 100644 --- a/cloud/aws/vpn/inputs.tf +++ b/cloud/aws/vpn/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -31,30 +31,31 @@ variable "filter_tags" { variable "vpn_status_enabled" { description = "Flag to enable VPN status monitor" - type = "string" + type = string default = "true" } variable "vpn_status_extra_tags" { description = "Extra tags for VPN status monitor" - type = "list" + type = list(string) default = [] } variable "vpn_status_message" { description = "Custom message for VPN status monitor" - type = "string" + type = string default = "" } variable "vpn_status_time_aggregator" { description = "Monitor aggregator for VPN status [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "vpn_status_timeframe" { description = "Monitor timeframe for VPN status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } + diff --git a/cloud/aws/vpn/monitors-vpn.tf b/cloud/aws/vpn/monitors-vpn.tf index 2c30a33..e158992 100644 --- a/cloud/aws/vpn/monitors-vpn.tf +++ b/cloud/aws/vpn/monitors-vpn.tf @@ -1,24 +1,24 @@ resource "datadog_monitor" "VPN_status" { - count = "${var.vpn_status_enabled == "true" ? 1 : 0}" + count = var.vpn_status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] VPN tunnel down" - message = "${coalesce(var.vpn_status_message, var.message)}" + message = coalesce(var.vpn_status_message, var.message) + type = "query alert" query = < ${var.failed_requests_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.failed_requests_threshold_critical}" - warning = "${var.failed_requests_threshold_warning}" - } +thresholds = { +critical = var.failed_requests_threshold_critical +warning = var.failed_requests_threshold_warning +} - type = "query alert" - notify_no_data = false - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 +notify_no_data = false +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay +evaluation_delay = var.evaluation_delay +renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", "${var.failed_requests_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", var.failed_requests_extra_tags] } resource "datadog_monitor" "apimgt_other_requests" { - count = "${var.other_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many other requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.other_requests_message, var.message)}" +count = var.other_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many other requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.other_requests_message, var.message) + type = "query alert" - query = < ${var.other_requests_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.other_requests_threshold_critical}" - warning = "${var.other_requests_threshold_warning}" - } +thresholds = { +critical = var.other_requests_threshold_critical +warning = var.other_requests_threshold_warning +} - type = "query alert" - notify_no_data = false - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 +notify_no_data = false +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay +evaluation_delay = var.evaluation_delay +renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", "${var.other_requests_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", var.other_requests_extra_tags] } resource "datadog_monitor" "apimgt_unauthorized_requests" { - count = "${var.unauthorized_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many unauthorized requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.unauthorized_requests_message, var.message)}" +count = var.unauthorized_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many unauthorized requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.unauthorized_requests_message, var.message) + type = "query alert" - query = < ${var.unauthorized_requests_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.unauthorized_requests_threshold_critical}" - warning = "${var.unauthorized_requests_threshold_warning}" + thresholds = { + critical = var.unauthorized_requests_threshold_critical + warning = var.unauthorized_requests_threshold_warning } - type = "query alert" notify_no_data = false notify_audit = false timeout_h = 1 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", "${var.unauthorized_requests_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", var.unauthorized_requests_extra_tags] } resource "datadog_monitor" "apimgt_successful_requests" { - count = "${var.successful_requests_enabled == "true" ? 1 : 0}" + count = var.successful_requests_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management successful requests rate too low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.successful_requests_message, var.message)}" + message = coalesce(var.successful_requests_message, var.message) + type = "query alert" query = < ${var.response_time_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.response_time_threshold_warning}" - critical = "${var.response_time_threshold_critical}" + thresholds = { + warning = var.response_time_threshold_warning + critical = var.response_time_threshold_critical } - notify_no_data = false # Will NOT notify when no data is received - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 require_full_window = false - timeout_h = 0 - include_tags = true + timeout_h = 0 + include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", "${var.response_time_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.response_time_extra_tags] } # Monitoring App Services memory usage resource "datadog_monitor" "appservices_memory_usage_count" { - count = "${var.memory_usage_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services memory usage {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + count = var.memory_usage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services memory usage {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" type = "query alert" - message = "${coalesce(var.memory_usage_message, var.message)}" + message = coalesce(var.memory_usage_message, var.message) query = < ${var.memory_usage_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +warning = var.memory_usage_threshold_warning +critical = var.memory_usage_threshold_critical +} - thresholds { - warning = "${var.memory_usage_threshold_warning}" - critical = "${var.memory_usage_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 0 +include_tags = true - notify_no_data = false # Will NOT notify when no data is received - renotify_interval = 0 - require_full_window = false - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", "${var.memory_usage_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.memory_usage_extra_tags] } # Monitoring App Services 5xx errors percent resource "datadog_monitor" "appservices_http_5xx_errors_count" { - count = "${var.http_5xx_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +count = var.http_5xx_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.http_5xx_requests_message, var.message) type = "query alert" - message = "${coalesce(var.http_5xx_requests_message, var.message)}" - query = < ${var.http_5xx_requests_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +warning = var.http_5xx_requests_threshold_warning +critical = var.http_5xx_requests_threshold_critical +} - thresholds { - warning = "${var.http_5xx_requests_threshold_warning}" - critical = "${var.http_5xx_requests_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 1 +include_tags = true - notify_no_data = false # Will NOT notify when no data is received - renotify_interval = 0 - require_full_window = false - timeout_h = 1 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", "${var.http_5xx_requests_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.http_5xx_requests_extra_tags] } # Monitoring App Services 4xx errors percent resource "datadog_monitor" "appservices_http_4xx_errors_count" { - count = "${var.http_4xx_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +count = var.http_4xx_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" type = "query alert" - message = "${coalesce(var.http_4xx_requests_message, var.message)}" +message = coalesce(var.http_4xx_requests_message, var.message) - query = < ${var.http_4xx_requests_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.http_4xx_requests_threshold_warning}" - critical = "${var.http_4xx_requests_threshold_critical}" + thresholds = { + warning = var.http_4xx_requests_threshold_warning + critical = var.http_4xx_requests_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false # Will NOT notify when no data is received renotify_interval = 0 require_full_window = false timeout_h = 1 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", "${var.http_4xx_requests_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.http_4xx_requests_extra_tags] } # Monitoring App Services HTTP 2xx & 3xx status pages percent resource "datadog_monitor" "appservices_http_success_status_rate" { - count = "${var.http_successful_requests_enabled == "true" ? 1 : 0}" + count = var.http_successful_requests_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP successful responses too low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" type = "query alert" - message = "${coalesce(var.http_successful_requests_message, var.message)}" + message = coalesce(var.http_successful_requests_message, var.message) query = < ${var.latency_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.latency_threshold_warning}" - critical = "${var.latency_threshold_critical}" + thresholds = { + warning = var.latency_threshold_warning + critical = var.latency_threshold_critical } - notify_no_data = true # Will not notify when no data is received - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 require_full_window = false - timeout_h = 0 - include_tags = true + timeout_h = 0 + include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform", "${var.latency_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform", var.latency_extra_tags] } # Monitoring Azure Search throttled queries resource "datadog_monitor" "azure_search_throttled_queries_rate" { - count = "${var.throttled_queries_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Search throttled queries rate is too high {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" + count = var.throttled_queries_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Search throttled queries rate is too high {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" + message = coalesce(var.throttled_queries_rate_message, var.message) type = "query alert" - message = "${coalesce(var.throttled_queries_rate_message, var.message)}" query = < ${var.throttled_queries_rate_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.throttled_queries_rate_threshold_warning}" - critical = "${var.throttled_queries_rate_threshold_critical}" - } - - notify_no_data = false # Will notify when no data is received - renotify_interval = 0 - require_full_window = false - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform", "${var.throttled_queries_rate_extra_tags}"] +thresholds = { +warning = var.throttled_queries_rate_threshold_warning +critical = var.throttled_queries_rate_threshold_critical } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 0 +include_tags = true + +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform", var.throttled_queries_rate_extra_tags] +} + diff --git a/cloud/azure/azure-search/outputs.tf b/cloud/azure/azure-search/outputs.tf index 8ab4045..c4e9e54 100644 --- a/cloud/azure/azure-search/outputs.tf +++ b/cloud/azure/azure-search/outputs.tf @@ -1,9 +1,10 @@ output "azure_search_latency_id" { description = "id for monitor azure_search_latency" - value = "${datadog_monitor.azure_search_latency.*.id}" + value = datadog_monitor.azure_search_latency.*.id } output "azure_search_throttled_queries_rate_id" { description = "id for monitor azure_search_throttled_queries_rate" - value = "${datadog_monitor.azure_search_throttled_queries_rate.*.id}" + value = datadog_monitor.azure_search_throttled_queries_rate.*.id } + diff --git a/cloud/azure/azure-search/versions.tf b/cloud/azure/azure-search/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/azure-search/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/cosmosdb/inputs.tf b/cloud/azure/cosmosdb/inputs.tf index 480f698..6c1c173 100644 --- a/cloud/azure/cosmosdb/inputs.tf +++ b/cloud/azure/cosmosdb/inputs.tf @@ -1,6 +1,6 @@ variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags_use_defaults" { @@ -40,43 +40,43 @@ variable "prefix_slug" { # Azure CosmosDB specific variables variable "status_enabled" { description = "Flag to enable Cosmos DB status monitor" - type = "string" + type = string default = "true" } variable "status_extra_tags" { description = "Extra tags for Cosmos DB status monitor" - type = "list" + type = list(string) default = [] } variable "status_message" { description = "Custom message for Cosmos DB status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Cosmos DB status [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "status_timeframe" { description = "Monitor timeframe for Cosmos DB status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "cosmos_db_4xx_requests_message" { description = "Custom message for Cosmos DB 4xx requests monitor" - type = "string" + type = string default = "" } variable "cosmos_db_4xx_requests_enabled" { description = "Flag to enable Cosmos DB 4xx requests monitor" - type = "string" + type = string default = "true" } @@ -92,31 +92,31 @@ variable "cosmos_db_4xx_request_rate_threshold_warning" { variable "cosmos_db_4xx_request_extra_tags" { description = "Extra tags for Cosmos DB 4xx requests monitor" - type = "list" + type = list(string) default = [] } variable "cosmos_db_4xx_request_time_aggregator" { description = "Monitor aggregator for Cosmos DB 4xx requests [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cosmos_db_4xx_request_timeframe" { description = "Monitor timeframe for Cosmos DB 4xx requests [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "cosmos_db_5xx_requests_message" { description = "Custom message for Cosmos DB 5xx requests monitor" - type = "string" + type = string default = "" } variable "cosmos_db_5xx_requests_enabled" { description = "Flag to enable Cosmos DB 5xx requests monitor" - type = "string" + type = string default = "true" } @@ -132,31 +132,31 @@ variable "cosmos_db_5xx_request_rate_threshold_warning" { variable "cosmos_db_5xx_request_rate_extra_tags" { description = "Extra tags for Cosmos DB 5xx requests monitor" - type = "list" + type = list(string) default = [] } variable "cosmos_db_5xx_request_time_aggregator" { description = "Monitor aggregator for Cosmos DB 5xx requests [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cosmos_db_5xx_request_timeframe" { description = "Monitor timeframe for Cosmos DB 5xx requests [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "cosmos_db_scaling_message" { description = "Custom message for Cosmos DB scaling monitor" - type = "string" + type = string default = "" } variable "cosmos_db_scaling_enabled" { description = "Flag to enable Cosmos DB scaling monitor" - type = "string" + type = string default = "true" } @@ -172,18 +172,19 @@ variable "cosmos_db_scaling_error_rate_threshold_warning" { variable "cosmos_db_scaling_extra_tags" { description = "Extra tags for Cosmos DB scaling monitor" - type = "list" + type = list(string) default = [] } variable "cosmos_db_scaling_time_aggregator" { description = "Monitor aggregator for Cosmos DB scaling [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cosmos_db_scaling_timeframe" { description = "Monitor timeframe for Cosmos DB scaling [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } + diff --git a/cloud/azure/cosmosdb/modules.tf b/cloud/azure/cosmosdb/modules.tf index 8ad7f82..d54aaf2 100644 --- a/cloud/azure/cosmosdb/modules.tf +++ b/cloud/azure/cosmosdb/modules.tf @@ -1,20 +1,21 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_cosmosdb" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } module "filter-tags-statuscode" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_cosmosdb" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded extra_tags = ["statuscode:%s"] } + diff --git a/cloud/azure/cosmosdb/monitors-cosmosdb.tf b/cloud/azure/cosmosdb/monitors-cosmosdb.tf index 24d3df5..fe5c83a 100644 --- a/cloud/azure/cosmosdb/monitors-cosmosdb.tf +++ b/cloud/azure/cosmosdb/monitors-cosmosdb.tf @@ -1,39 +1,37 @@ resource "datadog_monitor" "cosmos_db_status" { - count = "${var.status_enabled == "true" ? 1 : 0}" - + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB is down" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "metric alert" query = < ${var.cosmos_db_4xx_request_rate_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +critical = var.cosmos_db_4xx_request_rate_threshold_critical +warning = var.cosmos_db_4xx_request_rate_threshold_warning +} - thresholds { - critical = "${var.cosmos_db_4xx_request_rate_threshold_critical}" - warning = "${var.cosmos_db_4xx_request_rate_threshold_warning}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", "${var.cosmos_db_4xx_request_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", var.cosmos_db_4xx_request_extra_tags] } resource "datadog_monitor" "cosmos_db_5xx_requests" { - count = "${var.cosmos_db_5xx_requests_enabled == "true" ? 1 : 0}" +count = var.cosmos_db_5xx_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 5xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.cosmos_db_5xx_requests_message, var.message) + type = "query alert" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 5xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cosmos_db_5xx_requests_message, var.message)}" - - query = < ${var.cosmos_db_5xx_request_rate_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +critical = var.cosmos_db_5xx_request_rate_threshold_critical +warning = var.cosmos_db_5xx_request_rate_threshold_warning +} - thresholds { - critical = "${var.cosmos_db_5xx_request_rate_threshold_critical}" - warning = "${var.cosmos_db_5xx_request_rate_threshold_warning}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", "${var.cosmos_db_5xx_request_rate_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", var.cosmos_db_5xx_request_rate_extra_tags] } resource "datadog_monitor" "cosmos_db_scaling" { - count = "${var.cosmos_db_scaling_enabled == "true" ? 1 : 0}" +count = var.cosmos_db_scaling_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB max scaling reached for collection {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.cosmos_db_scaling_message, var.message) + type = "query alert" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB max scaling reached for collection {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cosmos_db_scaling_message, var.message)}" - - # List of available status codes : https://docs.microsoft.com/en-us/rest/api/cosmos-db/http-status-codes-for-cosmosdb - query = < ${var.cosmos_db_scaling_error_rate_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.cosmos_db_scaling_error_rate_threshold_critical}" - warning = "${var.cosmos_db_scaling_error_rate_threshold_warning}" + thresholds = { + critical = var.cosmos_db_scaling_error_rate_threshold_critical + warning = var.cosmos_db_scaling_error_rate_threshold_warning } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", "${var.cosmos_db_scaling_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", var.cosmos_db_scaling_extra_tags] } + diff --git a/cloud/azure/cosmosdb/outputs.tf b/cloud/azure/cosmosdb/outputs.tf index 41bc5ec..126abf3 100644 --- a/cloud/azure/cosmosdb/outputs.tf +++ b/cloud/azure/cosmosdb/outputs.tf @@ -1,19 +1,20 @@ output "cosmos_db_status_id" { description = "id for monitor cosmos_db_status" - value = "${datadog_monitor.cosmos_db_status.*.id}" + value = datadog_monitor.cosmos_db_status.*.id } output "cosmos_db_4xx_requests_id" { description = "id for monitor cosmos_db_4xx_requests" - value = "${datadog_monitor.cosmos_db_4xx_requests.*.id}" + value = datadog_monitor.cosmos_db_4xx_requests.*.id } output "cosmos_db_5xx_requests_id" { description = "id for monitor cosmos_db_5xx_requests" - value = "${datadog_monitor.cosmos_db_5xx_requests.*.id}" + value = datadog_monitor.cosmos_db_5xx_requests.*.id } output "cosmos_db_scaling_id" { description = "id for monitor cosmos_db_scaling" - value = "${datadog_monitor.cosmos_db_scaling.*.id}" + value = datadog_monitor.cosmos_db_scaling.*.id } + diff --git a/cloud/azure/cosmosdb/versions.tf b/cloud/azure/cosmosdb/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/cosmosdb/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/datalakestore/inputs.tf b/cloud/azure/datalakestore/inputs.tf index 21ed4f1..846e90d 100644 --- a/cloud/azure/datalakestore/inputs.tf +++ b/cloud/azure/datalakestore/inputs.tf @@ -1,6 +1,6 @@ variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags_use_defaults" { @@ -40,19 +40,19 @@ variable "prefix_slug" { # Azure Datalake Store specific variables variable "status_enabled" { description = "Flag to enable Datalake Store status monitor" - type = "string" + type = string default = "true" } variable "status_message" { description = "Custom message for Datalake Store status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Datalake Store status [available values: min, max or avg]" - type = "string" + type = string default = "max" } @@ -63,6 +63,7 @@ variable "status_timeframe" { variable "status_extra_tags" { description = "Extra tags for Datalake Store status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "list" + type = list(string) default = [] } + diff --git a/cloud/azure/datalakestore/modules.tf b/cloud/azure/datalakestore/modules.tf index e98fad1..b837d67 100644 --- a/cloud/azure/datalakestore/modules.tf +++ b/cloud/azure/datalakestore/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_datalakestore" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/datalakestore/monitors-datalakestore.tf b/cloud/azure/datalakestore/monitors-datalakestore.tf index edf703e..c4efbb2 100644 --- a/cloud/azure/datalakestore/monitors-datalakestore.tf +++ b/cloud/azure/datalakestore/monitors-datalakestore.tf @@ -1,26 +1,25 @@ resource "datadog_monitor" "datalakestore_status" { - count = "${var.status_enabled == "true" ? 1 : 0}" - + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Datalake Store is down" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.failed_messages_rate_thresold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +critical = var.failed_messages_rate_thresold_critical +warning = var.failed_messages_rate_thresold_warning +} - thresholds { - critical = "${var.failed_messages_rate_thresold_critical}" - warning = "${var.failed_messages_rate_thresold_warning}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform", "${var.failed_messages_rate_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform", var.failed_messages_rate_extra_tags] } resource "datadog_monitor" "eventgrid_unmatched_events" { - count = "${var.unmatched_events_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Grid too many unmatched events {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.unmatched_events_rate_message, var.message)}" +count = var.unmatched_events_rate_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Grid too many unmatched events {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.unmatched_events_rate_message, var.message) + type = "query alert" - query = < ${var.unmatched_events_rate_thresold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.unmatched_events_rate_thresold_critical}" - warning = "${var.unmatched_events_rate_thresold_warning}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform", "${var.unmatched_events_rate_extra_tags}"] +thresholds = { +critical = var.unmatched_events_rate_thresold_critical +warning = var.unmatched_events_rate_thresold_warning } + +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform", var.unmatched_events_rate_extra_tags] +} + diff --git a/cloud/azure/eventgrid/outputs.tf b/cloud/azure/eventgrid/outputs.tf index e209934..6369b0f 100644 --- a/cloud/azure/eventgrid/outputs.tf +++ b/cloud/azure/eventgrid/outputs.tf @@ -1,14 +1,15 @@ output "eventgrid_no_successful_message_id" { description = "id for monitor eventgrid_no_successful_message" - value = "${datadog_monitor.eventgrid_no_successful_message.*.id}" + value = datadog_monitor.eventgrid_no_successful_message.*.id } output "eventgrid_failed_messages_id" { description = "id for monitor eventgrid_failed_messages" - value = "${datadog_monitor.eventgrid_failed_messages.*.id}" + value = datadog_monitor.eventgrid_failed_messages.*.id } output "eventgrid_unmatched_events_id" { description = "id for monitor eventgrid_unmatched_events" - value = "${datadog_monitor.eventgrid_unmatched_events.*.id}" + value = datadog_monitor.eventgrid_unmatched_events.*.id } + diff --git a/cloud/azure/eventgrid/versions.tf b/cloud/azure/eventgrid/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/eventgrid/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/eventhub/inputs.tf b/cloud/azure/eventhub/inputs.tf index ca54d2e..a1bb291 100644 --- a/cloud/azure/eventhub/inputs.tf +++ b/cloud/azure/eventhub/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture environment" - type = "string" + type = string } # Global DataDog @@ -43,61 +43,61 @@ variable "filter_tags_custom_excluded" { variable "status_enabled" { description = "Flag to enable Event Hub status monitor" - type = "string" + type = string default = "true" } variable "status_extra_tags" { description = "Extra tags for Event Hub status monitor" - type = "list" + type = list(string) default = [] } variable "status_message" { description = "Custom message for Event Hub status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Event Hub status [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "status_timeframe" { description = "Monitor timeframe for Event Hub status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "failed_requests_rate_enabled" { description = "Flag to enable Event Hub failed requests monitor" - type = "string" + type = string default = "true" } variable "failed_requests_rate_extra_tags" { description = "Extra tags for Event Hub failed requests monitor" - type = "list" + type = list(string) default = [] } variable "failed_requests_rate_message" { description = "Custom message for Event Hub failed requests monitor" - type = "string" + type = string default = "" } variable "failed_requests_rate_time_aggregator" { description = "Monitor aggregator for Event Hub failed requests [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "failed_requests_rate_timeframe" { description = "Monitor timeframe for Event Hub failed requests [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -113,31 +113,31 @@ variable "failed_requests_rate_thresold_warning" { variable "errors_rate_enabled" { description = "Flag to enable Event Hub errors monitor" - type = "string" + type = string default = "true" } variable "errors_rate_extra_tags" { description = "Extra tags for Event Hub errors monitor" - type = "list" + type = list(string) default = [] } variable "errors_rate_message" { description = "Custom message for Event Hub errors monitor" - type = "string" + type = string default = "" } variable "errors_rate_time_aggregator" { description = "Monitor aggregator for Event Hub errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "errors_rate_timeframe" { description = "Monitor timeframe for Event Hub errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -150,3 +150,4 @@ variable "errors_rate_thresold_warning" { description = "Errors ratio (percentage) to trigger a warning alert" default = 50 } + diff --git a/cloud/azure/eventhub/modules.tf b/cloud/azure/eventhub/modules.tf index 5d204fa..15b8884 100644 --- a/cloud/azure/eventhub/modules.tf +++ b/cloud/azure/eventhub/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_eventhub" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/eventhub/monitors-eventhub.tf b/cloud/azure/eventhub/monitors-eventhub.tf index f79635b..3eb9d9f 100644 --- a/cloud/azure/eventhub/monitors-eventhub.tf +++ b/cloud/azure/eventhub/monitors-eventhub.tf @@ -1,91 +1,89 @@ resource "datadog_monitor" "eventhub_status" { - count = "${var.status_enabled == "true" ? 1 : 0}" + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub is down" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.failed_requests_rate_thresold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +critical = var.failed_requests_rate_thresold_critical +warning = var.failed_requests_rate_thresold_warning +} - thresholds { - critical = "${var.failed_requests_rate_thresold_critical}" - warning = "${var.failed_requests_rate_thresold_warning}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform", "${var.failed_requests_rate_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform", var.failed_requests_rate_extra_tags] } resource "datadog_monitor" "eventhub_errors" { - count = "${var.errors_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.errors_rate_message, var.message)}" +count = var.errors_rate_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.errors_rate_message, var.message) + type = "query alert" - query = < ${var.errors_rate_thresold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.errors_rate_thresold_critical}" - warning = "${var.errors_rate_thresold_warning}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform", "${var.errors_rate_extra_tags}"] +thresholds = { +critical = var.errors_rate_thresold_critical +warning = var.errors_rate_thresold_warning } + +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform", var.errors_rate_extra_tags] +} + diff --git a/cloud/azure/eventhub/outputs.tf b/cloud/azure/eventhub/outputs.tf index 33f384a..a2545ac 100644 --- a/cloud/azure/eventhub/outputs.tf +++ b/cloud/azure/eventhub/outputs.tf @@ -1,14 +1,15 @@ output "eventhub_status_id" { description = "id for monitor eventhub_status" - value = "${datadog_monitor.eventhub_status.*.id}" + value = datadog_monitor.eventhub_status.*.id } output "eventhub_failed_requests_id" { description = "id for monitor eventhub_failed_requests" - value = "${datadog_monitor.eventhub_failed_requests.*.id}" + value = datadog_monitor.eventhub_failed_requests.*.id } output "eventhub_errors_id" { description = "id for monitor eventhub_errors" - value = "${datadog_monitor.eventhub_errors.*.id}" + value = datadog_monitor.eventhub_errors.*.id } + diff --git a/cloud/azure/eventhub/versions.tf b/cloud/azure/eventhub/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/eventhub/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/functions/inputs.tf b/cloud/azure/functions/inputs.tf index d7497ff..b74679c 100644 --- a/cloud/azure/functions/inputs.tf +++ b/cloud/azure/functions/inputs.tf @@ -1,6 +1,6 @@ variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags_use_defaults" { @@ -41,31 +41,31 @@ variable "prefix_slug" { variable "http_5xx_errors_rate_enabled" { description = "Flag to enable Functions Http 5xx errors rate monitor" - type = "string" + type = string default = "true" } variable "http_5xx_errors_rate_extra_tags" { description = "Extra tags for Functions Http 5xx errors rate monitor" - type = "list" + type = list(string) default = [] } variable "http_5xx_errors_rate_message" { description = "Custom message for Functions Http 5xx errors rate monitor" - type = "string" + type = string default = "" } variable "http_5xx_errors_rate_time_aggregator" { description = "Monitor aggregator for Functions Http 5xx errors rate [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "http_5xx_errors_rate_timeframe" { description = "Monitor timeframe for Functions Http 5xx errors rate [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -81,31 +81,31 @@ variable "http_5xx_errors_rate_threshold_warning" { variable "high_connections_count_enabled" { description = "Flag to enable Functions high connections count monitor" - type = "string" + type = string default = "true" } variable "high_connections_count_extra_tags" { description = "Extra tags for Functions high connections count monitor" - type = "list" + type = list(string) default = [] } variable "high_connections_count_message" { description = "Custom message for Functions high connections count monitor" - type = "string" + type = string default = "" } variable "high_connections_count_time_aggregator" { description = "Monitor aggregator for Functions high connections count [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "high_connections_count_timeframe" { description = "Monitor timeframe for Functions high connections count [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -121,31 +121,31 @@ variable "high_connections_count_threshold_warning" { variable "high_threads_count_enabled" { description = "Flag to enable Functions high threads count monitor" - type = "string" + type = string default = "true" } variable "high_threads_count_extra_tags" { description = "Extra tags for Functions high threads count monitor" - type = "list" + type = list(string) default = [] } variable "high_threads_count_message" { description = "Custom message for Functions high threads count monitor" - type = "string" + type = string default = "" } variable "high_threads_count_time_aggregator" { description = "Monitor aggregator for Functions high threads count [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "high_threads_count_timeframe" { description = "Monitor timeframe for Functions high threads count [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -158,3 +158,4 @@ variable "high_threads_count_threshold_warning" { default = 490 description = "Warning threshold for Functions high threads count" } + diff --git a/cloud/azure/functions/modules.tf b/cloud/azure/functions/modules.tf index b68c9e6..8d6e1d0 100644 --- a/cloud/azure/functions/modules.tf +++ b/cloud/azure/functions/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_functions" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/functions/monitors-functions.tf b/cloud/azure/functions/monitors-functions.tf index 1f946ac..fb43c2f 100644 --- a/cloud/azure/functions/monitors-functions.tf +++ b/cloud/azure/functions/monitors-functions.tf @@ -1,87 +1,85 @@ resource "datadog_monitor" "function_http_5xx_errors_rate" { - count = "${var.http_5xx_errors_rate_enabled == "true" ? 1 : 0}" + count = var.http_5xx_errors_rate_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App HTTP 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" type = "query alert" - message = "${coalesce(var.http_5xx_errors_rate_message, var.message)}" + message = coalesce(var.http_5xx_errors_rate_message, var.message) query = < ${var.http_5xx_errors_rate_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.http_5xx_errors_rate_threshold_warning}" - critical = "${var.http_5xx_errors_rate_threshold_critical}" + thresholds = { + warning = var.http_5xx_errors_rate_threshold_warning + critical = var.http_5xx_errors_rate_threshold_critical } - notify_no_data = false - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 require_full_window = false - timeout_h = 1 - include_tags = true + timeout_h = 1 + include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform", "${var.http_5xx_errors_rate_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform", var.http_5xx_errors_rate_extra_tags] } resource "datadog_monitor" "function_high_connections_count" { - count = "${var.high_connections_count_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App connections count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + count = var.high_connections_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App connections count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" type = "query alert" - message = "${coalesce(var.high_connections_count_message, var.message)}" + message = coalesce(var.high_connections_count_message, var.message) query = < ${var.high_connections_count_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +warning = var.high_connections_count_threshold_warning +critical = var.high_connections_count_threshold_critical +} - thresholds { - warning = "${var.high_connections_count_threshold_warning}" - critical = "${var.high_connections_count_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 1 +include_tags = true - notify_no_data = false - renotify_interval = 0 - require_full_window = false - timeout_h = 1 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform", "${var.high_connections_count_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform", var.high_connections_count_extra_tags] } resource "datadog_monitor" "function_high_threads_count" { - count = "${var.high_threads_count_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App threads count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" +count = var.high_threads_count_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App threads count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" type = "query alert" - message = "${coalesce(var.high_threads_count_message, var.message)}" +message = coalesce(var.high_threads_count_message, var.message) - query = < ${var.high_threads_count_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.high_threads_count_threshold_warning}" - critical = "${var.high_threads_count_threshold_critical}" - } - - notify_no_data = false - renotify_interval = 0 - require_full_window = false - timeout_h = 1 - include_tags = true - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform", "${var.high_threads_count_extra_tags}"] +thresholds = { +warning = var.high_threads_count_threshold_warning +critical = var.high_threads_count_threshold_critical } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = false +timeout_h = 1 +include_tags = true + +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform", var.high_threads_count_extra_tags] +} + diff --git a/cloud/azure/functions/outputs.tf b/cloud/azure/functions/outputs.tf index 6782cff..a928a6b 100644 --- a/cloud/azure/functions/outputs.tf +++ b/cloud/azure/functions/outputs.tf @@ -1,14 +1,15 @@ output "function_http_5xx_errors_rate_id" { description = "id for monitor function_http_5xx_errors_rate" - value = "${datadog_monitor.function_http_5xx_errors_rate.*.id}" + value = datadog_monitor.function_http_5xx_errors_rate.*.id } output "function_high_connections_count_id" { description = "id for monitor function_high_connections_count" - value = "${datadog_monitor.function_high_connections_count.*.id}" + value = datadog_monitor.function_high_connections_count.*.id } output "function_high_threads_count_id" { description = "id for monitor function_high_threads_count" - value = "${datadog_monitor.function_high_threads_count.*.id}" + value = datadog_monitor.function_high_threads_count.*.id } + diff --git a/cloud/azure/functions/versions.tf b/cloud/azure/functions/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/functions/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/iothubs/inputs.tf b/cloud/azure/iothubs/inputs.tf index 0ede25b..1fa7bf5 100644 --- a/cloud/azure/iothubs/inputs.tf +++ b/cloud/azure/iothubs/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -43,115 +43,115 @@ variable "filter_tags_custom_excluded" { variable "status_enabled" { description = "Flag to enable IoT Hub status monitor" - type = "string" + type = string default = "true" } variable "status_extra_tags" { description = "Extra tags for IoT Hub status monitor" - type = "list" + type = list(string) default = [] } variable "status_message" { description = "Custom message for IoT Hub status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for IoT Hub status [available values: min, max, sum or avg]" - type = "string" + type = string default = "max" } variable "status_timeframe" { description = "Monitor timeframe for IoT Hub status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "total_devices_enabled" { description = "Flag to enable IoT Hub total devices monitor" - type = "string" + type = string default = "true" } variable "total_devices_extra_tags" { description = "Extra tags for IoT Hub total devices monitor" - type = "list" + type = list(string) default = [] } variable "total_devices_message" { description = "Custom message for IoT Hub total devices monitor" - type = "string" + type = string default = "" } variable "total_devices_time_aggregator" { description = "Monitor aggregator for IoT Hub total devices [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "total_devices_timeframe" { description = "Monitor timeframe for IoT Hub total devices [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "too_many_d2c_telemetry_ingress_nosent_enabled" { description = "Flag to enable IoT Hub unsent d2c telemetry monitor" - type = "string" + type = string default = "true" } variable "too_many_d2c_telemetry_ingress_nosent_extra_tags" { description = "Extra tags for IoT Hub unsent d2c telemetry monitor" - type = "list" + type = list(string) default = [] } variable "too_many_d2c_telemetry_ingress_nosent_message" { description = "Custom message for IoT Hub unsent d2c telemetry monitor" - type = "string" + type = string default = "" } variable "too_many_d2c_telemetry_ingress_nosent_timeframe" { description = "Monitor timeframe for IoT Hub unsent d2c telemetry [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "failed_jobs_rate_enabled" { description = "Flag to enable IoT Hub failed jobs monitor" - type = "string" + type = string default = "true" } variable "failed_jobs_rate_extra_tags" { description = "Extra tags for IoT Hub failed jobs monitor" - type = "list" + type = list(string) default = [] } variable "failed_jobs_rate_message" { description = "Custom message for IoT Hub failed jobs monitor" - type = "string" + type = string default = "" } variable "failed_jobs_rate_time_aggregator" { description = "Monitor aggregator for IoT Hub failed jobs [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "failed_jobs_rate_timeframe" { description = "Monitor timeframe for IoT Hub failed jobs [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -167,31 +167,31 @@ variable "failed_jobs_rate_threshold_critical" { variable "failed_listjobs_rate_enabled" { description = "Flag to enable IoT Hub failed list jobs monitor" - type = "string" + type = string default = "true" } variable "failed_listjobs_rate_extra_tags" { description = "Extra tags for IoT Hub failed list jobs monitor" - type = "list" + type = list(string) default = [] } variable "failed_listjobs_rate_message" { description = "Custom message for IoT Hub failed list jobs monitor" - type = "string" + type = string default = "" } variable "failed_listjobs_rate_time_aggregator" { description = "Monitor aggregator for IoT Hub failed list jobs [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "failed_listjobs_rate_timeframe" { description = "Monitor timeframe for IoT Hub failed list jobs [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -207,31 +207,31 @@ variable "failed_listjobs_rate_threshold_critical" { variable "failed_queryjobs_rate_enabled" { description = "Flag to enable IoT Hub failed query jobs monitor" - type = "string" + type = string default = "true" } variable "failed_queryjobs_rate_extra_tags" { description = "Extra tags for IoT Hub failed query jobs monitor" - type = "list" + type = list(string) default = [] } variable "failed_queryjobs_rate_message" { description = "Custom message for IoT Hub failed query jobs monitor" - type = "string" + type = string default = "" } variable "failed_queryjobs_rate_time_aggregator" { description = "Monitor aggregator for IoT Hub failed query jobs [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "failed_queryjobs_rate_timeframe" { description = "Monitor timeframe for IoT Hub failed query jobs [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -247,31 +247,31 @@ variable "failed_queryjobs_rate_threshold_critical" { variable "failed_c2d_methods_rate_enabled" { description = "Flag to enable IoT Hub failed c2d methods monitor" - type = "string" + type = string default = "true" } variable "failed_c2d_methods_rate_extra_tags" { description = "Extra tags for IoT Hub failed c2d methods monitor" - type = "list" + type = list(string) default = [] } variable "failed_c2d_methods_rate_message" { description = "Custom message for IoT Hub failed c2d method monitor" - type = "string" + type = string default = "" } variable "failed_c2d_methods_rate_time_aggregator" { description = "Monitor aggregator for IoT Hub failed c2d method [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "failed_c2d_methods_rate_timeframe" { description = "Monitor timeframe for IoT Hub failed c2d method [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -287,31 +287,31 @@ variable "failed_c2d_methods_rate_threshold_critical" { variable "failed_c2d_twin_read_rate_enabled" { description = "Flag to enable IoT Hub failed c2d twin read monitor" - type = "string" + type = string default = "true" } variable "failed_c2d_twin_read_rate_extra_tags" { description = "Extra tags for IoT Hub failed c2d twin read monitor" - type = "list" + type = list(string) default = [] } variable "failed_c2d_twin_read_rate_message" { description = "Custom message for IoT Hub failed c2d twin read monitor" - type = "string" + type = string default = "" } variable "failed_c2d_twin_read_rate_time_aggregator" { description = "Monitor aggregator for IoT Hub failed c2d twin read [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "failed_c2d_twin_read_rate_timeframe" { description = "Monitor timeframe for IoT Hub failed c2d twin read [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -327,31 +327,31 @@ variable "failed_c2d_twin_read_rate_threshold_critical" { variable "failed_c2d_twin_update_rate_enabled" { description = "Flag to enable IoT Hub failed c2d twin update monitor" - type = "string" + type = string default = "true" } variable "failed_c2d_twin_update_rate_extra_tags" { description = "Extra tags for IoT Hub failed c2d twin update monitor" - type = "list" + type = list(string) default = [] } variable "failed_c2d_twin_update_rate_message" { description = "Custom message for IoT Hub failed c2d twin update monitor" - type = "string" + type = string default = "" } variable "failed_c2d_twin_update_rate_time_aggregator" { description = "Monitor aggregator for IoT Hub failed c2d twin update [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "failed_c2d_twin_update_rate_timeframe" { description = "Monitor timeframe for IoT Hub failed c2d twin update [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -367,31 +367,31 @@ variable "failed_c2d_twin_update_rate_threshold_critical" { variable "failed_d2c_twin_read_rate_enabled" { description = "Flag to enable IoT Hub failed d2c twin read monitor" - type = "string" + type = string default = "true" } variable "failed_d2c_twin_read_rate_extra_tags" { description = "Extra tags for IoT Hub failed d2c twin read monitor" - type = "list" + type = list(string) default = [] } variable "failed_d2c_twin_read_rate_message" { description = "Custom message for IoT Hub failed d2c twin read monitor" - type = "string" + type = string default = "" } variable "failed_d2c_twin_read_rate_time_aggregator" { description = "Monitor aggregator for IoT Hub failed d2c twin read [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "failed_d2c_twin_read_rate_timeframe" { description = "Monitor timeframe for IoT Hub failed d2c twin read [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -407,31 +407,31 @@ variable "failed_d2c_twin_read_rate_threshold_critical" { variable "failed_d2c_twin_update_rate_enabled" { description = "Flag to enable IoT Hub failed d2c twin update monitor" - type = "string" + type = string default = "true" } variable "failed_d2c_twin_update_rate_extra_tags" { description = "Extra tags for IoT Hub failed d2c twin update monitor" - type = "list" + type = list(string) default = [] } variable "failed_d2c_twin_update_rate_message" { description = "Custom message for IoT Hub failed d2c twin update monitor" - type = "string" + type = string default = "" } variable "failed_d2c_twin_update_rate_time_aggregator" { description = "Monitor aggregator for IoT Hub failed d2c twin update [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "failed_d2c_twin_update_rate_timeframe" { description = "Monitor timeframe for IoT Hub failed d2c twin update [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -447,31 +447,31 @@ variable "failed_d2c_twin_update_rate_threshold_critical" { variable "dropped_d2c_telemetry_egress_enabled" { description = "Flag to enable IoT Hub dropped d2c telemetry monitor" - type = "string" + type = string default = "true" } variable "dropped_d2c_telemetry_egress_extra_tags" { description = "Extra tags for IoT Hub dropped d2c telemetry monitor" - type = "list" + type = list(string) default = [] } variable "dropped_d2c_telemetry_egress_message" { description = "Custom message for IoT Hub dropped d2c telemetry monitor" - type = "string" + type = string default = "" } variable "dropped_d2c_telemetry_egress_time_aggregator" { description = "Monitor aggregator for IoT Hub dropped d2c telemetry [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "dropped_d2c_telemetry_egress_timeframe" { description = "Monitor timeframe for IoT Hub dropped d2c telemetry [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -487,31 +487,31 @@ variable "dropped_d2c_telemetry_egress_rate_threshold_critical" { variable "orphaned_d2c_telemetry_egress_enabled" { description = "Flag to enable IoT Hub orphaned d2c telemetry monitor" - type = "string" + type = string default = "true" } variable "orphaned_d2c_telemetry_egress_extra_tags" { description = "Extra tags for IoT Hub orphaned d2c telemetry monitor" - type = "list" + type = list(string) default = [] } variable "orphaned_d2c_telemetry_egress_message" { description = "Custom message for IoT Hub orphaned d2c telemetry monitor" - type = "string" + type = string default = "" } variable "orphaned_d2c_telemetry_egress_time_aggregator" { description = "Monitor aggregator for IoT Hub orphaned d2c telemetry [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "orphaned_d2c_telemetry_egress_timeframe" { description = "Monitor timeframe for IoT Hub orphaned d2c telemetry [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -527,31 +527,31 @@ variable "orphaned_d2c_telemetry_egress_rate_threshold_critical" { variable "invalid_d2c_telemetry_egress_enabled" { description = "Flag to enable IoT Hub invalid d2c telemetry monitor" - type = "string" + type = string default = "true" } variable "invalid_d2c_telemetry_egress_extra_tags" { description = "Extra tags for IoT Hub invalid d2c telemetry monitor" - type = "list" + type = list(string) default = [] } variable "invalid_d2c_telemetry_egress_message" { description = "Custom message for IoT Hub invalid d2c telemetry monitor" - type = "string" + type = string default = "" } variable "invalid_d2c_telemetry_egress_time_aggregator" { description = "Monitor aggregator for IoT Hub invalid d2c telemetry [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "invalid_d2c_telemetry_egress_timeframe" { description = "Monitor timeframe for IoT Hub invalid d2c telemetry [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -564,3 +564,4 @@ variable "invalid_d2c_telemetry_egress_rate_threshold_critical" { description = "D2C Telemetry Invalid limit (critical threshold)" default = 90 } + diff --git a/cloud/azure/iothubs/modules.tf b/cloud/azure/iothubs/modules.tf index cb481a0..887245d 100644 --- a/cloud/azure/iothubs/modules.tf +++ b/cloud/azure/iothubs/modules.tf @@ -1,8 +1,9 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_iothubs" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom } + diff --git a/cloud/azure/iothubs/monitors-iothubs.tf b/cloud/azure/iothubs/monitors-iothubs.tf index 7681534..2df299a 100644 --- a/cloud/azure/iothubs/monitors-iothubs.tf +++ b/cloud/azure/iothubs/monitors-iothubs.tf @@ -1,7 +1,8 @@ resource "datadog_monitor" "too_many_jobs_failed" { - count = "${var.failed_jobs_rate_enabled == "true" ? 1 : 0}" + count = var.failed_jobs_rate_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many jobs failed {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.failed_jobs_rate_message, var.message)}" + message = coalesce(var.failed_jobs_rate_message, var.message) + type = "query alert" query = < ${var.failed_jobs_rate_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.failed_jobs_rate_threshold_warning}" - critical = "${var.failed_jobs_rate_threshold_critical}" + thresholds = { + warning = var.failed_jobs_rate_threshold_warning + critical = var.failed_jobs_rate_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.failed_jobs_rate_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_jobs_rate_extra_tags] } resource "datadog_monitor" "too_many_list_jobs_failed" { - count = "${var.failed_listjobs_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many list_jobs failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.failed_listjobs_rate_message, var.message)}" + count = var.failed_listjobs_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many list_jobs failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_listjobs_rate_message, var.message) + type = "query alert" query = < ${var.failed_listjobs_rate_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.failed_listjobs_rate_threshold_warning +critical = var.failed_listjobs_rate_threshold_critical +} - thresholds { - warning = "${var.failed_listjobs_rate_threshold_warning}" - critical = "${var.failed_listjobs_rate_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.failed_listjobs_rate_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_listjobs_rate_extra_tags] } resource "datadog_monitor" "too_many_query_jobs_failed" { - count = "${var.failed_queryjobs_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many query_jobs failed {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.failed_queryjobs_rate_message, var.message)}" +count = var.failed_queryjobs_rate_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many query_jobs failed {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.failed_queryjobs_rate_message, var.message) + type = "query alert" - query = < ${var.failed_queryjobs_rate_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.failed_queryjobs_rate_threshold_warning +critical = var.failed_queryjobs_rate_threshold_critical +} - thresholds { - warning = "${var.failed_queryjobs_rate_threshold_warning}" - critical = "${var.failed_queryjobs_rate_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.failed_queryjobs_rate_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_queryjobs_rate_extra_tags] } resource "datadog_monitor" "status" { - count = "${var.status_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub is down" - message = "${coalesce(var.status_message, var.message)}" +count = var.status_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub is down" +message = coalesce(var.status_message, var.message) + type = "query alert" - query = < ${var.failed_c2d_methods_rate_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.failed_c2d_methods_rate_threshold_warning +critical = var.failed_c2d_methods_rate_threshold_critical +} - thresholds { - warning = "${var.failed_c2d_methods_rate_threshold_warning}" - critical = "${var.failed_c2d_methods_rate_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.failed_c2d_methods_rate_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_c2d_methods_rate_extra_tags] } resource "datadog_monitor" "too_many_c2d_twin_read_failed" { - count = "${var.failed_c2d_twin_read_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin read failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.failed_c2d_twin_read_rate_message, var.message)}" +count = var.failed_c2d_twin_read_rate_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin read failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.failed_c2d_twin_read_rate_message, var.message) + type = "query alert" - query = < ${var.failed_c2d_twin_read_rate_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.failed_c2d_twin_read_rate_threshold_warning +critical = var.failed_c2d_twin_read_rate_threshold_critical +} - thresholds { - warning = "${var.failed_c2d_twin_read_rate_threshold_warning}" - critical = "${var.failed_c2d_twin_read_rate_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.failed_c2d_twin_read_rate_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_c2d_twin_read_rate_extra_tags] } resource "datadog_monitor" "too_many_c2d_twin_update_failed" { - count = "${var.failed_c2d_twin_update_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin update failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.failed_c2d_twin_update_rate_message, var.message)}" +count = var.failed_c2d_twin_update_rate_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin update failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.failed_c2d_twin_update_rate_message, var.message) + type = "query alert" - query = < ${var.failed_c2d_twin_update_rate_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.failed_c2d_twin_update_rate_threshold_warning}" - critical = "${var.failed_c2d_twin_update_rate_threshold_critical}" + thresholds = { + warning = var.failed_c2d_twin_update_rate_threshold_warning + critical = var.failed_c2d_twin_update_rate_threshold_critical } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 1 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.failed_c2d_twin_update_rate_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_c2d_twin_update_rate_extra_tags] } resource "datadog_monitor" "too_many_d2c_twin_read_failed" { - count = "${var.failed_d2c_twin_read_rate_enabled == "true" ? 1 : 0}" + count = var.failed_d2c_twin_read_rate_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c twin read failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.failed_d2c_twin_read_rate_message, var.message)}" + message = coalesce(var.failed_d2c_twin_read_rate_message, var.message) + type = "query alert" query = < ${var.failed_d2c_twin_read_rate_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.failed_d2c_twin_read_rate_threshold_warning}" - critical = "${var.failed_d2c_twin_read_rate_threshold_critical}" + thresholds = { + warning = var.failed_d2c_twin_read_rate_threshold_warning + critical = var.failed_d2c_twin_read_rate_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.failed_d2c_twin_read_rate_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_d2c_twin_read_rate_extra_tags] } resource "datadog_monitor" "too_many_d2c_twin_update_failed" { - count = "${var.failed_d2c_twin_update_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c twin update failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.failed_d2c_twin_update_rate_message, var.message)}" + count = var.failed_d2c_twin_update_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c twin update failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_d2c_twin_update_rate_message, var.message) + type = "query alert" query = < ${var.failed_d2c_twin_update_rate_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.failed_d2c_twin_update_rate_threshold_warning +critical = var.failed_d2c_twin_update_rate_threshold_critical +} - thresholds { - warning = "${var.failed_d2c_twin_update_rate_threshold_warning}" - critical = "${var.failed_d2c_twin_update_rate_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.failed_d2c_twin_update_rate_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_d2c_twin_update_rate_extra_tags] } resource "datadog_monitor" "too_many_d2c_telemetry_egress_dropped" { - count = "${var.dropped_d2c_telemetry_egress_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress dropped {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.dropped_d2c_telemetry_egress_message, var.message)}" +count = var.dropped_d2c_telemetry_egress_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress dropped {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" +message = coalesce(var.dropped_d2c_telemetry_egress_message, var.message) + type = "query alert" - query = < ${var.dropped_d2c_telemetry_egress_rate_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.dropped_d2c_telemetry_egress_rate_threshold_warning +critical = var.dropped_d2c_telemetry_egress_rate_threshold_critical +} - thresholds { - warning = "${var.dropped_d2c_telemetry_egress_rate_threshold_warning}" - critical = "${var.dropped_d2c_telemetry_egress_rate_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.dropped_d2c_telemetry_egress_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.dropped_d2c_telemetry_egress_extra_tags] } resource "datadog_monitor" "too_many_d2c_telemetry_egress_orphaned" { - count = "${var.orphaned_d2c_telemetry_egress_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress orphaned {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.orphaned_d2c_telemetry_egress_message, var.message)}" +count = var.orphaned_d2c_telemetry_egress_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress orphaned {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" +message = coalesce(var.orphaned_d2c_telemetry_egress_message, var.message) + type = "query alert" - query = < ${var.orphaned_d2c_telemetry_egress_rate_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.orphaned_d2c_telemetry_egress_rate_threshold_warning}" - critical = "${var.orphaned_d2c_telemetry_egress_rate_threshold_critical}" + thresholds = { + warning = var.orphaned_d2c_telemetry_egress_rate_threshold_warning + critical = var.orphaned_d2c_telemetry_egress_rate_threshold_critical } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 1 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.orphaned_d2c_telemetry_egress_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.orphaned_d2c_telemetry_egress_extra_tags] } resource "datadog_monitor" "too_many_d2c_telemetry_egress_invalid" { - count = "${var.invalid_d2c_telemetry_egress_enabled == "true" ? 1 : 0}" + count = var.invalid_d2c_telemetry_egress_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress invalid {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.invalid_d2c_telemetry_egress_message, var.message)}" + message = coalesce(var.invalid_d2c_telemetry_egress_message, var.message) + type = "query alert" query = < ${var.invalid_d2c_telemetry_egress_rate_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.invalid_d2c_telemetry_egress_rate_threshold_warning}" - critical = "${var.invalid_d2c_telemetry_egress_rate_threshold_critical}" + thresholds = { + warning = var.invalid_d2c_telemetry_egress_rate_threshold_warning + critical = var.invalid_d2c_telemetry_egress_rate_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.invalid_d2c_telemetry_egress_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.invalid_d2c_telemetry_egress_extra_tags] } resource "datadog_monitor" "too_many_d2c_telemetry_ingress_nosent" { - count = "${var.too_many_d2c_telemetry_ingress_nosent_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry ingress not sent {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.too_many_d2c_telemetry_ingress_nosent_message, var.message)}" + count = var.too_many_d2c_telemetry_ingress_nosent_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry ingress not sent {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.too_many_d2c_telemetry_ingress_nosent_message,var.message) + type = "query alert" query = < 0 - EOQ +EOQ - type = "query alert" +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", "${var.too_many_d2c_telemetry_ingress_nosent_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.too_many_d2c_telemetry_ingress_nosent_extra_tags] } + diff --git a/cloud/azure/iothubs/outputs.tf b/cloud/azure/iothubs/outputs.tf index 95c7cc0..5107ffc 100644 --- a/cloud/azure/iothubs/outputs.tf +++ b/cloud/azure/iothubs/outputs.tf @@ -1,69 +1,70 @@ output "too_many_jobs_failed_id" { description = "id for monitor too_many_jobs_failed" - value = "${datadog_monitor.too_many_jobs_failed.*.id}" + value = datadog_monitor.too_many_jobs_failed.*.id } output "too_many_list_jobs_failed_id" { description = "id for monitor too_many_list_jobs_failed" - value = "${datadog_monitor.too_many_list_jobs_failed.*.id}" + value = datadog_monitor.too_many_list_jobs_failed.*.id } output "too_many_query_jobs_failed_id" { description = "id for monitor too_many_query_jobs_failed" - value = "${datadog_monitor.too_many_query_jobs_failed.*.id}" + value = datadog_monitor.too_many_query_jobs_failed.*.id } output "status_id" { description = "id for monitor status" - value = "${datadog_monitor.status.*.id}" + value = datadog_monitor.status.*.id } output "total_devices_id" { description = "id for monitor total_devices" - value = "${datadog_monitor.total_devices.*.id}" + value = datadog_monitor.total_devices.*.id } output "too_many_c2d_methods_failed_id" { description = "id for monitor too_many_c2d_methods_failed" - value = "${datadog_monitor.too_many_c2d_methods_failed.*.id}" + value = datadog_monitor.too_many_c2d_methods_failed.*.id } output "too_many_c2d_twin_read_failed_id" { description = "id for monitor too_many_c2d_twin_read_failed" - value = "${datadog_monitor.too_many_c2d_twin_read_failed.*.id}" + value = datadog_monitor.too_many_c2d_twin_read_failed.*.id } output "too_many_c2d_twin_update_failed_id" { description = "id for monitor too_many_c2d_twin_update_failed" - value = "${datadog_monitor.too_many_c2d_twin_update_failed.*.id}" + value = datadog_monitor.too_many_c2d_twin_update_failed.*.id } output "too_many_d2c_twin_read_failed_id" { description = "id for monitor too_many_d2c_twin_read_failed" - value = "${datadog_monitor.too_many_d2c_twin_read_failed.*.id}" + value = datadog_monitor.too_many_d2c_twin_read_failed.*.id } output "too_many_d2c_twin_update_failed_id" { description = "id for monitor too_many_d2c_twin_update_failed" - value = "${datadog_monitor.too_many_d2c_twin_update_failed.*.id}" + value = datadog_monitor.too_many_d2c_twin_update_failed.*.id } output "too_many_d2c_telemetry_egress_dropped_id" { description = "id for monitor too_many_d2c_telemetry_egress_dropped" - value = "${datadog_monitor.too_many_d2c_telemetry_egress_dropped.*.id}" + value = datadog_monitor.too_many_d2c_telemetry_egress_dropped.*.id } output "too_many_d2c_telemetry_egress_orphaned_id" { description = "id for monitor too_many_d2c_telemetry_egress_orphaned" - value = "${datadog_monitor.too_many_d2c_telemetry_egress_orphaned.*.id}" + value = datadog_monitor.too_many_d2c_telemetry_egress_orphaned.*.id } output "too_many_d2c_telemetry_egress_invalid_id" { description = "id for monitor too_many_d2c_telemetry_egress_invalid" - value = "${datadog_monitor.too_many_d2c_telemetry_egress_invalid.*.id}" + value = datadog_monitor.too_many_d2c_telemetry_egress_invalid.*.id } output "too_many_d2c_telemetry_ingress_nosent_id" { description = "id for monitor too_many_d2c_telemetry_ingress_nosent" - value = "${datadog_monitor.too_many_d2c_telemetry_ingress_nosent.*.id}" + value = datadog_monitor.too_many_d2c_telemetry_ingress_nosent.*.id } + diff --git a/cloud/azure/iothubs/versions.tf b/cloud/azure/iothubs/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/iothubs/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/keyvault/inputs.tf b/cloud/azure/keyvault/inputs.tf index 86775cf..15a0040 100644 --- a/cloud/azure/keyvault/inputs.tf +++ b/cloud/azure/keyvault/inputs.tf @@ -1,6 +1,6 @@ variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags_use_defaults" { @@ -40,19 +40,19 @@ variable "prefix_slug" { # Azure Key Vault specific variables variable "status_enabled" { description = "Flag to enable Key Vault status monitor" - type = "string" + type = string default = "true" } variable "status_message" { description = "Custom message for Key Vault status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Key Vault status [available values: min, max or avg]" - type = "string" + type = string default = "max" } @@ -63,25 +63,25 @@ variable "status_timeframe" { variable "status_extra_tags" { description = "Extra tags for Key Vault status monitor" - type = "list" + type = list(string) default = [] } variable "api_result_enabled" { description = "Flag to enable Key Vault API result monitor" - type = "string" + type = string default = "true" } variable "api_result_message" { description = "Custom message for Key Vault API result monitor" - type = "string" + type = string default = "" } variable "api_result_time_aggregator" { description = "Monitor aggregator for Key Vault API result [available values: min, max or avg]" - type = "string" + type = string default = "max" } @@ -102,25 +102,25 @@ variable "api_result_threshold_warning" { variable "api_result_extra_tags" { description = "Extra tags for Key Vault API result monitor" - type = "list" + type = list(string) default = [] } variable "api_latency_enabled" { description = "Flag to enable Key Vault API latency monitor" - type = "string" + type = string default = "true" } variable "api_latency_message" { description = "Custom message for Key Vault API latency monitor" - type = "string" + type = string default = "" } variable "api_latency_time_aggregator" { description = "Monitor aggregator for Key Vault API latency [available values: min, max or avg]" - type = "string" + type = string default = "min" } @@ -141,6 +141,7 @@ variable "api_latency_threshold_warning" { variable "api_latency_extra_tags" { description = "Extra tags for Key Vault API latency monitor" - type = "list" + type = list(string) default = [] } + diff --git a/cloud/azure/keyvault/modules.tf b/cloud/azure/keyvault/modules.tf index 6e6f876..9fd2ab3 100644 --- a/cloud/azure/keyvault/modules.tf +++ b/cloud/azure/keyvault/modules.tf @@ -1,31 +1,32 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_keyvault" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } module "filter-tags-statuscode" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_keyvault" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded extra_tags = ["statuscode:%s"] } module "filter-tags-activity" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_keyvault" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded extra_tags_excluded = ["activityname:secretlist"] } + diff --git a/cloud/azure/keyvault/monitors-keyvault.tf b/cloud/azure/keyvault/monitors-keyvault.tf index 6005b71..aabad04 100644 --- a/cloud/azure/keyvault/monitors-keyvault.tf +++ b/cloud/azure/keyvault/monitors-keyvault.tf @@ -1,35 +1,33 @@ resource "datadog_monitor" "keyvault_status" { - count = "${var.status_enabled == "true" ? 1 : 0}" - + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Key Vault is down" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.api_latency_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.api_latency_threshold_critical}" - warning = "${var.api_latency_threshold_warning}" - } - - type = "metric alert" - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform", "${var.api_latency_extra_tags}"] +thresholds = { +critical = var.api_latency_threshold_critical +warning = var.api_latency_threshold_warning } + +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform", var.api_latency_extra_tags] +} + diff --git a/cloud/azure/keyvault/outputs.tf b/cloud/azure/keyvault/outputs.tf index a6a4ca0..91b5d99 100644 --- a/cloud/azure/keyvault/outputs.tf +++ b/cloud/azure/keyvault/outputs.tf @@ -1,14 +1,15 @@ output "keyvault_status_id" { description = "id for monitor keyvault_status" - value = "${datadog_monitor.keyvault_status.*.id}" + value = datadog_monitor.keyvault_status.*.id } output "keyvault_api_result_id" { description = "id for monitor keyvault_api_result" - value = "${datadog_monitor.keyvault_api_result.*.id}" + value = datadog_monitor.keyvault_api_result.*.id } output "keyvault_api_latency_id" { description = "id for monitor keyvault_api_latency" - value = "${datadog_monitor.keyvault_api_latency.*.id}" + value = datadog_monitor.keyvault_api_latency.*.id } + diff --git a/cloud/azure/keyvault/versions.tf b/cloud/azure/keyvault/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/keyvault/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/load-balancer/inputs.tf b/cloud/azure/load-balancer/inputs.tf index 8e99ec8..9707a46 100644 --- a/cloud/azure/load-balancer/inputs.tf +++ b/cloud/azure/load-balancer/inputs.tf @@ -1,6 +1,6 @@ variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags_use_defaults" { @@ -40,19 +40,19 @@ variable "prefix_slug" { # Azure Load Balancer specific variables variable "status_enabled" { description = "Flag to enable Load Balancer status monitor" - type = "string" + type = string default = "true" } variable "status_message" { description = "Custom message for Load Balancer status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Load Balancer status [available values: min, max or avg]" - type = "string" + type = string default = "max" } @@ -63,6 +63,7 @@ variable "status_timeframe" { variable "status_extra_tags" { description = "Extra tags for Load Balancer status monitor" - type = "list" + type = list(string) default = [] } + diff --git a/cloud/azure/load-balancer/modules.tf b/cloud/azure/load-balancer/modules.tf index 760e10f..d68393b 100644 --- a/cloud/azure/load-balancer/modules.tf +++ b/cloud/azure/load-balancer/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_load-balancer" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/load-balancer/monitors-load-balancer.tf b/cloud/azure/load-balancer/monitors-load-balancer.tf index 45ede58..a67ab49 100644 --- a/cloud/azure/load-balancer/monitors-load-balancer.tf +++ b/cloud/azure/load-balancer/monitors-load-balancer.tf @@ -1,26 +1,25 @@ resource "datadog_monitor" "loadbalancer_status" { - count = "${var.status_enabled == "true" ? 1 : 0}" - + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Load Balancer is unreachable" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.cpu_usage_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.cpu_usage_threshold_critical}" - warning = "${var.cpu_usage_threshold_warning}" + thresholds = { + critical = var.cpu_usage_threshold_critical + warning = var.cpu_usage_threshold_warning } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", "${var.cpu_usage_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.cpu_usage_extra_tags] } resource "datadog_monitor" "mysql_free_storage" { - count = "${var.free_storage_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server storage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.free_storage_message, var.message)}" + count = var.free_storage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server storage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.free_storage_message, var.message) + type = "query alert" query = < ${var.io_consumption_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +critical = var.io_consumption_threshold_critical +warning = var.io_consumption_threshold_warning +} - thresholds { - critical = "${var.io_consumption_threshold_critical}" - warning = "${var.io_consumption_threshold_warning}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", "${var.io_consumption_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.io_consumption_extra_tags] } resource "datadog_monitor" "mysql_memory_usage" { - count = "${var.memory_usage_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.memory_usage_message, var.message)}" +count = var.memory_usage_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.memory_usage_message, var.message) + type = "query alert" - query = < ${var.memory_usage_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.memory_usage_threshold_critical}" - warning = "${var.memory_usage_threshold_warning}" + thresholds = { + critical = var.memory_usage_threshold_critical + warning = var.memory_usage_threshold_warning } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", "${var.memory_usage_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.memory_usage_extra_tags] } + diff --git a/cloud/azure/mysql/outputs.tf b/cloud/azure/mysql/outputs.tf index 3b22ff3..ace5b8a 100644 --- a/cloud/azure/mysql/outputs.tf +++ b/cloud/azure/mysql/outputs.tf @@ -1,19 +1,20 @@ output "mysql_cpu_usage_id" { description = "id for monitor mysql_cpu_usage" - value = "${datadog_monitor.mysql_cpu_usage.*.id}" + value = datadog_monitor.mysql_cpu_usage.*.id } output "mysql_free_storage_id" { description = "id for monitor mysql_free_storage" - value = "${datadog_monitor.mysql_free_storage.*.id}" + value = datadog_monitor.mysql_free_storage.*.id } output "mysql_io_consumption_id" { description = "id for monitor mysql_io_consumption" - value = "${datadog_monitor.mysql_io_consumption.*.id}" + value = datadog_monitor.mysql_io_consumption.*.id } output "mysql_memory_usage_id" { description = "id for monitor mysql_memory_usage" - value = "${datadog_monitor.mysql_memory_usage.*.id}" + value = datadog_monitor.mysql_memory_usage.*.id } + diff --git a/cloud/azure/mysql/versions.tf b/cloud/azure/mysql/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/mysql/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/postgresql/inputs.tf b/cloud/azure/postgresql/inputs.tf index 137e1b2..38f779a 100644 --- a/cloud/azure/postgresql/inputs.tf +++ b/cloud/azure/postgresql/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture environment" - type = "string" + type = string } # Global DataDog @@ -38,31 +38,31 @@ variable "filter_tags_custom" { variable "cpu_usage_enabled" { description = "Flag to enable PostgreSQL status monitor" - type = "string" + type = string default = "true" } variable "cpu_usage_extra_tags" { description = "Extra tags for PostgreSQL status monitor" - type = "list" + type = list(string) default = [] } variable "cpu_usage_message" { description = "Custom message for PostgreSQL CPU monitor" - type = "string" + type = string default = "" } variable "cpu_usage_time_aggregator" { description = "Monitor aggregator for PostgreSQL CPU [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cpu_usage_timeframe" { description = "Monitor timeframe for PostgreSQL CPU [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -78,61 +78,61 @@ variable "cpu_usage_threshold_critical" { variable "no_connection_enabled" { description = "Flag to enable PostgreSQL status monitor" - type = "string" + type = string default = "true" } variable "no_connection_extra_tags" { description = "Extra tags for PostgreSQL status monitor" - type = "list" + type = list(string) default = [] } variable "no_connection_message" { description = "Custom message for PostgreSQL no connection monitor" - type = "string" + type = string default = "" } variable "no_connection_time_aggregator" { description = "Monitor aggregator for PostgreSQL no connection [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "no_connection_timeframe" { description = "Monitor timeframe for PostgreSQL no connection [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "free_storage_enabled" { description = "Flag to enable PostgreSQL status monitor" - type = "string" + type = string default = "true" } variable "free_storage_extra_tags" { description = "Extra tags for PostgreSQL status monitor" - type = "list" + type = list(string) default = [] } variable "free_storage_message" { description = "Custom message for PostgreSQL Free Storage monitor" - type = "string" + type = string default = "" } variable "free_storage_time_aggregator" { description = "Monitor aggregator for PostgreSQL Free Storage [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "free_storage_timeframe" { description = "Monitor timeframe for PostgreSQL Free Storage [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -148,31 +148,31 @@ variable "free_storage_threshold_critical" { variable "io_consumption_enabled" { description = "Flag to enable PostgreSQL status monitor" - type = "string" + type = string default = "true" } variable "io_consumption_extra_tags" { description = "Extra tags for PostgreSQL status monitor" - type = "list" + type = list(string) default = [] } variable "io_consumption_message" { description = "Custom message for PostgreSQL IO consumption monitor" - type = "string" + type = string default = "" } variable "io_consumption_time_aggregator" { description = "Monitor aggregator for PostgreSQL IO consumption [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "io_consumption_timeframe" { description = "Monitor timeframe for PostgreSQL IO consumption [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -188,31 +188,31 @@ variable "io_consumption_threshold_critical" { variable "memory_usage_enabled" { description = "Flag to enable PostgreSQL status monitor" - type = "string" + type = string default = "true" } variable "memory_usage_extra_tags" { description = "Extra tags for PostgreSQL status monitor" - type = "list" + type = list(string) default = [] } variable "memory_usage_message" { description = "Custom message for PostgreSQL memory monitor" - type = "string" + type = string default = "" } variable "memory_usage_time_aggregator" { description = "Monitor aggregator for PostgreSQL memory [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "memory_usage_timeframe" { description = "Monitor timeframe for PostgreSQL memory [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -225,3 +225,4 @@ variable "memory_usage_threshold_critical" { description = "PostgreSQL memory usage in percent (critical threshold)" default = "90" } + diff --git a/cloud/azure/postgresql/modules.tf b/cloud/azure/postgresql/modules.tf index 8183a7b..52a7f41 100644 --- a/cloud/azure/postgresql/modules.tf +++ b/cloud/azure/postgresql/modules.tf @@ -1,8 +1,9 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_postgresql" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom } + diff --git a/cloud/azure/postgresql/monitors-postegresql.tf b/cloud/azure/postgresql/monitors-postegresql.tf index 679278f..4c11d57 100644 --- a/cloud/azure/postgresql/monitors-postegresql.tf +++ b/cloud/azure/postgresql/monitors-postegresql.tf @@ -1,149 +1,146 @@ resource "datadog_monitor" "postgresql_cpu_usage" { - count = "${var.cpu_usage_enabled == "true" ? 1 : 0}" + count = var.cpu_usage_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Postgresql Server CPU usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cpu_usage_message, var.message)}" + message = coalesce(var.cpu_usage_message, var.message) + type = "query alert" query = < ${var.cpu_usage_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.cpu_usage_threshold_critical}" - warning = "${var.cpu_usage_threshold_warning}" + thresholds = { + critical = var.cpu_usage_threshold_critical + warning = var.cpu_usage_threshold_warning } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", "${var.cpu_usage_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", var.cpu_usage_extra_tags] } resource "datadog_monitor" "postgresql_no_connection" { - count = "${var.no_connection_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Postgresql Server has no connection" - message = "${coalesce(var.no_connection_message, var.message)}" + count = var.no_connection_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Postgresql Server has no connection" + message = coalesce(var.no_connection_message, var.message) + type = "query alert" query = < ${var.io_consumption_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.io_consumption_threshold_critical}" - warning = "${var.io_consumption_threshold_warning}" + thresholds = { + critical = var.io_consumption_threshold_critical + warning = var.io_consumption_threshold_warning } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", "${var.io_consumption_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", var.io_consumption_extra_tags] } resource "datadog_monitor" "postgresql_memory_usage" { - count = "${var.memory_usage_enabled == "true" ? 1 : 0}" + count = var.memory_usage_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Postgresql Server memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.memory_usage_message, var.message)}" + message = coalesce(var.memory_usage_message, var.message) + type = "query alert" query = < ${var.memory_usage_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.memory_usage_threshold_critical}" - warning = "${var.memory_usage_threshold_warning}" + thresholds = { + critical = var.memory_usage_threshold_critical + warning = var.memory_usage_threshold_warning } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", "${var.memory_usage_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", var.memory_usage_extra_tags] } + diff --git a/cloud/azure/postgresql/outputs.tf b/cloud/azure/postgresql/outputs.tf index 52b8398..86e9d8b 100644 --- a/cloud/azure/postgresql/outputs.tf +++ b/cloud/azure/postgresql/outputs.tf @@ -1,24 +1,25 @@ output "postgresql_cpu_usage_id" { description = "id for monitor postgresql_cpu_usage" - value = "${datadog_monitor.postgresql_cpu_usage.*.id}" + value = datadog_monitor.postgresql_cpu_usage.*.id } output "postgresql_no_connection_id" { description = "id for monitor postgresql_no_connection" - value = "${datadog_monitor.postgresql_no_connection.*.id}" + value = datadog_monitor.postgresql_no_connection.*.id } output "postgresql_free_storage_id" { description = "id for monitor postgresql_free_storage" - value = "${datadog_monitor.postgresql_free_storage.*.id}" + value = datadog_monitor.postgresql_free_storage.*.id } output "postgresql_io_consumption_id" { description = "id for monitor postgresql_io_consumption" - value = "${datadog_monitor.postgresql_io_consumption.*.id}" + value = datadog_monitor.postgresql_io_consumption.*.id } output "postgresql_memory_usage_id" { description = "id for monitor postgresql_memory_usage" - value = "${datadog_monitor.postgresql_memory_usage.*.id}" + value = datadog_monitor.postgresql_memory_usage.*.id } + diff --git a/cloud/azure/postgresql/versions.tf b/cloud/azure/postgresql/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/postgresql/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/redis/inputs.tf b/cloud/azure/redis/inputs.tf index 7737430..0bb5758 100644 --- a/cloud/azure/redis/inputs.tf +++ b/cloud/azure/redis/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture environment" - type = "string" + type = string } # Global DataDog @@ -43,61 +43,61 @@ variable "filter_tags_custom_excluded" { variable "status_enabled" { description = "Flag to enable Redis status monitor" - type = "string" + type = string default = "true" } variable "status_extra_tags" { description = "Extra tags for Redis status monitor" - type = "list" + type = list(string) default = [] } variable "status_message" { description = "Custom message for Redis status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Redis status [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "status_timeframe" { description = "Monitor timeframe for Redis status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "evictedkeys_limit_enabled" { description = "Flag to enable Redis evicted keys monitor" - type = "string" + type = string default = "true" } variable "evictedkeys_limit_extra_tags" { description = "Extra tags for Redis evicted keys monitor" - type = "list" + type = list(string) default = [] } variable "evictedkeys_limit_message" { description = "Custom message for Redis evicted keys monitor" - type = "string" + type = string default = "" } variable "evictedkeys_limit_time_aggregator" { description = "Monitor aggregator for Redis evicted keys [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "evictedkeys_limit_timeframe" { description = "Monitor timeframe for Redis evicted keys [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -113,31 +113,31 @@ variable "evictedkeys_limit_threshold_critical" { variable "percent_processor_time_enabled" { description = "Flag to enable Redis processor monitor" - type = "string" + type = string default = "true" } variable "percent_processor_time_extra_tags" { description = "Extra tags for Redis processor monitor" - type = "list" + type = list(string) default = [] } variable "percent_processor_time_message" { description = "Custom message for Redis processor monitor" - type = "string" + type = string default = "" } variable "percent_processor_time_time_aggregator" { description = "Monitor aggregator for Redis processor [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "percent_processor_time_timeframe" { description = "Monitor timeframe for Redis processor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -153,31 +153,31 @@ variable "percent_processor_time_threshold_warning" { variable "server_load_rate_enabled" { description = "Flag to enable Redis server load monitor" - type = "string" + type = string default = "true" } variable "server_load_rate_extra_tags" { description = "Extra tags for Redis server load monitor" - type = "list" + type = list(string) default = [] } variable "server_load_rate_message" { description = "Custom message for Redis server load monitor" - type = "string" + type = string default = "" } variable "server_load_rate_time_aggregator" { description = "Monitor aggregator for Redis server load [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "server_load_rate_timeframe" { description = "Monitor timeframe for Redis server load [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -190,3 +190,4 @@ variable "server_load_rate_threshold_warning" { description = "Server CPU load rate (warning threshold)" default = 70 } + diff --git a/cloud/azure/redis/modules.tf b/cloud/azure/redis/modules.tf index 8ffca7d..1c038f7 100644 --- a/cloud/azure/redis/modules.tf +++ b/cloud/azure/redis/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_redis" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/redis/monitors-azure-redis.tf b/cloud/azure/redis/monitors-azure-redis.tf index fd38fc2..5e90fbe 100644 --- a/cloud/azure/redis/monitors-azure-redis.tf +++ b/cloud/azure/redis/monitors-azure-redis.tf @@ -1,118 +1,115 @@ resource "datadog_monitor" "status" { - count = "${var.status_enabled == "true" ? 1 : 0}" + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis {{name}} is down" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.evictedkeys_limit_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.evictedkeys_limit_threshold_warning +critical = var.evictedkeys_limit_threshold_critical +} - thresholds { - warning = "${var.evictedkeys_limit_threshold_warning}" - critical = "${var.evictedkeys_limit_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", "${var.evictedkeys_limit_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", var.evictedkeys_limit_extra_tags] } resource "datadog_monitor" "percent_processor_time" { - count = "${var.percent_processor_time_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis processor time too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.percent_processor_time_message, var.message)}" +count = var.percent_processor_time_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis processor time too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.percent_processor_time_message, var.message) + type = "query alert" - query = < ${var.percent_processor_time_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.percent_processor_time_threshold_warning +critical = var.percent_processor_time_threshold_critical +} - thresholds { - warning = "${var.percent_processor_time_threshold_warning}" - critical = "${var.percent_processor_time_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", "${var.percent_processor_time_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", var.percent_processor_time_extra_tags] } resource "datadog_monitor" "server_load" { - count = "${var.server_load_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis server load too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.server_load_rate_message, var.message)}" +count = var.server_load_rate_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis server load too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.server_load_rate_message, var.message) + type = "query alert" - query = < ${var.server_load_rate_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.server_load_rate_threshold_warning}" - critical = "${var.server_load_rate_threshold_critical}" + thresholds = { + warning = var.server_load_rate_threshold_warning + critical = var.server_load_rate_threshold_critical } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", "${var.server_load_rate_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", var.server_load_rate_extra_tags] } + diff --git a/cloud/azure/redis/outputs.tf b/cloud/azure/redis/outputs.tf index f3c64a1..b4c71da 100644 --- a/cloud/azure/redis/outputs.tf +++ b/cloud/azure/redis/outputs.tf @@ -1,19 +1,20 @@ output "status_id" { description = "id for monitor status" - value = "${datadog_monitor.status.*.id}" + value = datadog_monitor.status.*.id } output "evictedkeys_id" { description = "id for monitor evictedkeys" - value = "${datadog_monitor.evictedkeys.*.id}" + value = datadog_monitor.evictedkeys.*.id } output "percent_processor_time_id" { description = "id for monitor percent_processor_time" - value = "${datadog_monitor.percent_processor_time.*.id}" + value = datadog_monitor.percent_processor_time.*.id } output "server_load_id" { description = "id for monitor server_load" - value = "${datadog_monitor.server_load.*.id}" + value = datadog_monitor.server_load.*.id } + diff --git a/cloud/azure/redis/versions.tf b/cloud/azure/redis/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/redis/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/serverfarms/inputs.tf b/cloud/azure/serverfarms/inputs.tf index a3f5962..dfb2743 100644 --- a/cloud/azure/serverfarms/inputs.tf +++ b/cloud/azure/serverfarms/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture environment" - type = "string" + type = string } # Global DataDog @@ -39,62 +39,62 @@ variable "filter_tags_custom" { # Status variable "status_enabled" { description = "Flag to enable the serverfarms status monitor" - type = "string" + type = string default = "true" } variable "status_message" { description = "Custom message for serverfarm status monitor" - type = "string" + type = string default = "" } variable "status_extra_tags" { description = "Extra tags for serverfarms status monitor" - type = "list" + type = list(string) default = [] } variable "status_time_aggregator" { description = "Monitor aggregator for serverfarms status [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "status_timeframe" { description = "Monitor timeframe for serverfarms status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } # CPU percentage variable "cpu_percentage_enabled" { description = "Flag to enable the serverfarms cpu_percentage monitor" - type = "string" + type = string default = "true" } variable "cpu_percentage_message" { description = "Custom message for serverfarm cpu_percentage monitor" - type = "string" + type = string default = "" } variable "cpu_percentage_extra_tags" { description = "Extra tags for serverfarms cpu_percentage monitor" - type = "list" + type = list(string) default = [] } variable "cpu_percentage_time_aggregator" { description = "Monitor aggregator for serverfarms cpu_percentage [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cpu_percentage_timeframe" { description = "Monitor timeframe for serverfarms cpu_percentage [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_10m" } @@ -111,31 +111,31 @@ variable "cpu_percentage_threshold_warning" { # Memory percentage variable "memory_percentage_enabled" { description = "Flag to enable the serverfarms memory_percentage monitor" - type = "string" + type = string default = "true" } variable "memory_percentage_message" { description = "Custom message for serverfarm memory_percentage monitor" - type = "string" + type = string default = "" } variable "memory_percentage_extra_tags" { description = "Extra tags for serverfarms memory_percentage monitor" - type = "list" + type = list(string) default = [] } variable "memory_percentage_time_aggregator" { description = "Monitor aggregator for serverfarms memory_percentage [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "memory_percentage_timeframe" { description = "Monitor timeframe for serverfarms memory_percentage [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -148,3 +148,4 @@ variable "memory_percentage_threshold_warning" { description = "Memory percentage (warning threshold)" default = 90 } + diff --git a/cloud/azure/serverfarms/modules.tf b/cloud/azure/serverfarms/modules.tf index 96acfda..ed11dfa 100644 --- a/cloud/azure/serverfarms/modules.tf +++ b/cloud/azure/serverfarms/modules.tf @@ -1,8 +1,9 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_serverfarms" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom } + diff --git a/cloud/azure/serverfarms/monitors-azure-serverfarms.tf b/cloud/azure/serverfarms/monitors-azure-serverfarms.tf index 1dccf59..bd492f6 100644 --- a/cloud/azure/serverfarms/monitors-azure-serverfarms.tf +++ b/cloud/azure/serverfarms/monitors-azure-serverfarms.tf @@ -1,87 +1,85 @@ resource "datadog_monitor" "status" { - count = "${var.status_enabled == "true" ? 1 : 0}" + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Serverfarm is down" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.cpu_percentage_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.cpu_percentage_threshold_warning +critical = var.cpu_percentage_threshold_critical +} - thresholds { - warning = "${var.cpu_percentage_threshold_warning}" - critical = "${var.cpu_percentage_threshold_critical}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform", "${var.cpu_percentage_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform", var.cpu_percentage_extra_tags] } resource "datadog_monitor" "memory_percentage" { - count = "${var.memory_percentage_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Serverfarm memory percentage is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.memory_percentage_message, var.message)}" +count = var.memory_percentage_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Serverfarm memory percentage is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.memory_percentage_message, var.message) + type = "query alert" - query = < ${var.memory_percentage_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.memory_percentage_threshold_warning}" - critical = "${var.memory_percentage_threshold_critical}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform", "${var.memory_percentage_extra_tags}"] +thresholds = { +warning = var.memory_percentage_threshold_warning +critical = var.memory_percentage_threshold_critical } + +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform", var.memory_percentage_extra_tags] +} + diff --git a/cloud/azure/serverfarms/outputs.tf b/cloud/azure/serverfarms/outputs.tf index c021806..2780151 100644 --- a/cloud/azure/serverfarms/outputs.tf +++ b/cloud/azure/serverfarms/outputs.tf @@ -1,14 +1,15 @@ output "status_id" { description = "id for monitor status" - value = "${datadog_monitor.status.*.id}" + value = datadog_monitor.status.*.id } output "cpu_percentage_id" { description = "id for monitor cpu_percentage" - value = "${datadog_monitor.cpu_percentage.*.id}" + value = datadog_monitor.cpu_percentage.*.id } output "memory_percentage_id" { description = "id for monitor memory_percentage" - value = "${datadog_monitor.memory_percentage.*.id}" + value = datadog_monitor.memory_percentage.*.id } + diff --git a/cloud/azure/serverfarms/versions.tf b/cloud/azure/serverfarms/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/serverfarms/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/servicebus/inputs.tf b/cloud/azure/servicebus/inputs.tf index 6b69823..d70daee 100644 --- a/cloud/azure/servicebus/inputs.tf +++ b/cloud/azure/servicebus/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -42,25 +42,25 @@ variable "filter_tags_custom_excluded" { # Azure Service Bus specific variables variable "status_enabled" { description = "Flag to enable Service Bus status monitor" - type = "string" + type = string default = "true" } variable "status_extra_tags" { description = "Extra tags for Service Bus status monitor" - type = "list" + type = list(string) default = [] } variable "status_message" { description = "Custom message for Service Bus status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Service Bus status [available values: min, max or avg]" - type = "string" + type = string default = "max" } @@ -71,49 +71,49 @@ variable "status_timeframe" { variable "no_active_connections_enabled" { description = "Flag to enable Service Bus status monitor" - type = "string" + type = string default = "true" } variable "no_active_connections_message" { description = "Custom message for Service Bus status monitor" - type = "string" + type = string default = "" } variable "no_active_connections_time_aggregator" { description = "Monitor aggregator for Service Bus status [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "no_active_connections_timeframe" { description = "Monitor timeframe for Service Bus status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "server_errors_message" { description = "Custom message for Service Bus server errors monitor" - type = "string" + type = string default = "" } variable "server_errors_enabled" { description = "Flag to enable Service Bus server errors monitor" - type = "string" + type = string default = "true" } variable "server_errors_time_aggregator" { description = "Monitor aggregator for Service Bus server errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "server_errors_timeframe" { description = "Monitor timeframe for Service Bus server errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -129,25 +129,25 @@ variable "server_errors_threshold_warning" { variable "user_errors_message" { description = "Custom message for Service Bus user errors monitor" - type = "string" + type = string default = "" } variable "user_errors_enabled" { description = "Flag to enable Service Bus user errors monitor" - type = "string" + type = string default = "true" } variable "user_errors_time_aggregator" { description = "Monitor aggregator for Service Bus user errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "user_errors_timeframe" { description = "Monitor timeframe for Service Bus user errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -160,3 +160,4 @@ variable "user_errors_threshold_warning" { description = "Warning threshold for Service Bus user errors monitor" default = 50 } + diff --git a/cloud/azure/servicebus/modules.tf b/cloud/azure/servicebus/modules.tf index 78ee1ae..4abc459 100644 --- a/cloud/azure/servicebus/modules.tf +++ b/cloud/azure/servicebus/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_servicebus" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/servicebus/monitors-service-bus.tf b/cloud/azure/servicebus/monitors-service-bus.tf index ccad349..22da17e 100644 --- a/cloud/azure/servicebus/monitors-service-bus.tf +++ b/cloud/azure/servicebus/monitors-service-bus.tf @@ -1,119 +1,112 @@ resource "datadog_monitor" "servicebus_status" { - count = "${var.status_enabled == "true" ? 1 : 0}" - + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus is down" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.user_errors_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +critical = var.user_errors_threshold_critical +warning = var.user_errors_threshold_warning +} - thresholds { - critical = "${var.user_errors_threshold_critical}" - warning = "${var.user_errors_threshold_warning}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] +tags = ["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] } resource "datadog_monitor" "service_bus_server_errors" { - count = "${var.server_errors_enabled == "true" ? 1 : 0}" +count = var.server_errors_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus server errors rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.server_errors_message, var.message) + type = "query alert" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus server errors rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.server_errors_message, var.message)}" - - query = < ${var.server_errors_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.server_errors_threshold_critical}" - warning = "${var.server_errors_threshold_warning}" + thresholds = { + critical = var.server_errors_threshold_critical + warning = var.server_errors_threshold_warning } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] } + diff --git a/cloud/azure/servicebus/outputs.tf b/cloud/azure/servicebus/outputs.tf index ad117a1..0f0aaff 100644 --- a/cloud/azure/servicebus/outputs.tf +++ b/cloud/azure/servicebus/outputs.tf @@ -1,19 +1,20 @@ output "servicebus_status_id" { description = "id for monitor servicebus_status" - value = "${datadog_monitor.servicebus_status.*.id}" + value = datadog_monitor.servicebus_status.*.id } output "service_bus_no_active_connections_id" { description = "id for monitor service_bus_no_active_connections" - value = "${datadog_monitor.service_bus_no_active_connections.*.id}" + value = datadog_monitor.service_bus_no_active_connections.*.id } output "service_bus_user_errors_id" { description = "id for monitor service_bus_user_errors" - value = "${datadog_monitor.service_bus_user_errors.*.id}" + value = datadog_monitor.service_bus_user_errors.*.id } output "service_bus_server_errors_id" { description = "id for monitor service_bus_server_errors" - value = "${datadog_monitor.service_bus_server_errors.*.id}" + value = datadog_monitor.service_bus_server_errors.*.id } + diff --git a/cloud/azure/servicebus/versions.tf b/cloud/azure/servicebus/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/servicebus/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/sql-database/inputs.tf b/cloud/azure/sql-database/inputs.tf index 10190b5..9a65ed0 100644 --- a/cloud/azure/sql-database/inputs.tf +++ b/cloud/azure/sql-database/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -43,61 +43,61 @@ variable "filter_tags_custom_excluded" { variable "status_enabled" { description = "Flag to enable Redis status monitor" - type = "string" + type = string default = "true" } variable "status_extra_tags" { description = "Extra tags for Redis status monitor" - type = "list" + type = list(string) default = [] } variable "status_message" { description = "Custom message for Redis status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Redis status [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "status_timeframe" { description = "Monitor timeframe for Redis status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "cpu_enabled" { description = "Flag to enable SQL CPU monitor" - type = "string" + type = string default = "true" } variable "cpu_extra_tags" { description = "Extra tags for SQL CPU monitor" - type = "list" + type = list(string) default = [] } variable "cpu_message" { description = "Custom message for SQL CPU monitor" - type = "string" + type = string default = "" } variable "cpu_time_aggregator" { description = "Monitor aggregator for SQL CPU [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cpu_timeframe" { description = "Monitor timeframe for SQL CPU [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -113,31 +113,31 @@ variable "cpu_threshold_critical" { variable "diskspace_enabled" { description = "Flag to enable SQL disk space monitor" - type = "string" + type = string default = "true" } variable "diskspace_extra_tags" { description = "Extra tags for SQL disk space monitor" - type = "list" + type = list(string) default = [] } variable "diskspace_message" { description = "Custom message for SQL disk space monitor" - type = "string" + type = string default = "" } variable "diskspace_time_aggregator" { description = "Monitor aggregator for SQL disk space [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "diskspace_timeframe" { description = "Monitor timeframe for SQL disk space [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -153,31 +153,31 @@ variable "diskspace_threshold_critical" { variable "dtu_enabled" { description = "Flag to enable SQL DTU monitor" - type = "string" + type = string default = "true" } variable "dtu_extra_tags" { description = "Extra tags for SQL DTU monitor" - type = "list" + type = list(string) default = [] } variable "dtu_message" { description = "Custom message for SQL DTU monitor" - type = "string" + type = string default = "" } variable "dtu_time_aggregator" { description = "Monitor aggregator for SQL DTU [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "dtu_timeframe" { description = "Monitor timeframe for SQL DTU [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -193,25 +193,25 @@ variable "dtu_threshold_critical" { variable "deadlock_enabled" { description = "Flag to enable SQL Deadlock monitor" - type = "string" + type = string default = "true" } variable "deadlock_extra_tags" { description = "Extra tags for SQL Deadlock monitor" - type = "list" + type = list(string) default = [] } variable "deadlock_message" { description = "Custom message for SQL Deadlock monitor" - type = "string" + type = string default = "" } variable "deadlock_timeframe" { description = "Monitor timeframe for SQL Deadlock [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -219,3 +219,4 @@ variable "deadlock_threshold_critical" { description = "Amount of Deadlocks (critical threshold)" default = "1" } + diff --git a/cloud/azure/sql-database/modules.tf b/cloud/azure/sql-database/modules.tf index 3f6833a..6f0c6de 100644 --- a/cloud/azure/sql-database/modules.tf +++ b/cloud/azure/sql-database/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_sql-database" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/sql-database/monitors-sql-database.tf b/cloud/azure/sql-database/monitors-sql-database.tf index 6d8908c..2eb2635 100644 --- a/cloud/azure/sql-database/monitors-sql-database.tf +++ b/cloud/azure/sql-database/monitors-sql-database.tf @@ -1,148 +1,144 @@ resource "datadog_monitor" "status" { - count = "${var.status_enabled == "true" ? 1 : 0}" + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database is down" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.cpu_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +critical = var.cpu_threshold_critical +warning = var.cpu_threshold_warning +} - thresholds { - critical = "${var.cpu_threshold_critical}" - warning = "${var.cpu_threshold_warning}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", "${var.cpu_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", var.cpu_extra_tags] } resource "datadog_monitor" "sql-database_free_space_low" { - count = "${var.diskspace_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database high disk usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.diskspace_message, var.message)}" - +count = var.diskspace_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database high disk usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.diskspace_message, var.message) type = "query alert" - query = < ${var.diskspace_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.diskspace_threshold_warning}" - critical = "${var.diskspace_threshold_critical}" - } +thresholds = { +warning = var.diskspace_threshold_warning +critical = var.diskspace_threshold_critical +} - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", "${var.diskspace_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", var.diskspace_extra_tags] } resource "datadog_monitor" "sql-database_dtu_consumption_high" { - count = "${var.dtu_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.dtu_message, var.message)}" - +count = var.dtu_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.dtu_message, var.message) type = "query alert" - query = < ${var.dtu_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.dtu_threshold_warning}" - critical = "${var.dtu_threshold_critical}" + thresholds = { + warning = var.dtu_threshold_warning + critical = var.dtu_threshold_critical } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", "${var.dtu_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", var.dtu_extra_tags] } resource "datadog_monitor" "sql-database_deadlocks_count" { - count = "${var.deadlock_enabled == "true" ? 1 : 0}" + count = var.deadlock_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database Deadlocks too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.deadlock_message, var.message)}" - + message = coalesce(var.deadlock_message, var.message) type = "query alert" query = < ${var.deadlock_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.deadlock_threshold_critical}" + thresholds = { + critical = var.deadlock_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", "${var.deadlock_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", var.deadlock_extra_tags] } + diff --git a/cloud/azure/sql-database/outputs.tf b/cloud/azure/sql-database/outputs.tf index d31edbf..964b748 100644 --- a/cloud/azure/sql-database/outputs.tf +++ b/cloud/azure/sql-database/outputs.tf @@ -1,24 +1,25 @@ output "status_id" { description = "id for monitor status" - value = "${datadog_monitor.status.*.id}" + value = datadog_monitor.status.*.id } output "sql-database_cpu_id" { description = "id for monitor sql-database_cpu" - value = "${datadog_monitor.sql-database_cpu.*.id}" + value = datadog_monitor.sql-database_cpu.*.id } output "sql-database_free_space_low_id" { description = "id for monitor sql-database_free_space_low" - value = "${datadog_monitor.sql-database_free_space_low.*.id}" + value = datadog_monitor.sql-database_free_space_low.*.id } output "sql-database_dtu_consumption_high_id" { description = "id for monitor sql-database_dtu_consumption_high" - value = "${datadog_monitor.sql-database_dtu_consumption_high.*.id}" + value = datadog_monitor.sql-database_dtu_consumption_high.*.id } output "sql-database_deadlocks_count_id" { description = "id for monitor sql-database_deadlocks_count" - value = "${datadog_monitor.sql-database_deadlocks_count.*.id}" + value = datadog_monitor.sql-database_deadlocks_count.*.id } + diff --git a/cloud/azure/sql-database/versions.tf b/cloud/azure/sql-database/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/sql-database/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/sql-elasticpool/inputs.tf b/cloud/azure/sql-elasticpool/inputs.tf index 89f63ec..b6fee13 100644 --- a/cloud/azure/sql-elasticpool/inputs.tf +++ b/cloud/azure/sql-elasticpool/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -43,31 +43,31 @@ variable "filter_tags_custom_excluded" { variable "cpu_enabled" { description = "Flag to enable SQL Elastic Pool CPU monitor" - type = "string" + type = string default = "true" } variable "cpu_extra_tags" { description = "Extra tags for SQL Elastic Pool CPU monitor" - type = "list" + type = list(string) default = [] } variable "cpu_message" { description = "Custom message for SQL Elastic Pool CPU monitor" - type = "string" + type = string default = "" } variable "cpu_time_aggregator" { description = "Monitor aggregator for SQL Elastic Pool CPU [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cpu_timeframe" { description = "Monitor timeframe for SQL Elastic Pool CPU [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -83,31 +83,31 @@ variable "cpu_threshold_critical" { variable "diskspace_enabled" { description = "Flag to enable SQL Elastic Pool disk space monitor" - type = "string" + type = string default = "true" } variable "diskspace_extra_tags" { description = "Extra tags for SQL Elastic Pool disk space monitor" - type = "list" + type = list(string) default = [] } variable "diskspace_message" { description = "Custom message for SQL Elastic Pool disk space monitor" - type = "string" + type = string default = "" } variable "diskspace_time_aggregator" { description = "Monitor aggregator for SQL Elastic Pool disk space [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "diskspace_timeframe" { description = "Monitor timeframe for SQL Elastic Pool disk space [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -123,31 +123,31 @@ variable "diskspace_threshold_critical" { variable "dtu_enabled" { description = "Flag to enable SQL Elastic Pool DTU monitor" - type = "string" + type = string default = "true" } variable "dtu_extra_tags" { description = "Extra tags for SQL Elastic Pool DTU monitor" - type = "list" + type = list(string) default = [] } variable "dtu_message" { description = "Custom message for SQL Elastic Pool DTU monitor" - type = "string" + type = string default = "" } variable "dtu_time_aggregator" { description = "Monitor aggregator for SQL Elastic Pool DTU [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "dtu_timeframe" { description = "Monitor timeframe for SQL Elastic Pool DTU [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -160,3 +160,4 @@ variable "dtu_threshold_critical" { description = "Amount of DTU used (critical threshold)" default = "90" } + diff --git a/cloud/azure/sql-elasticpool/modules.tf b/cloud/azure/sql-elasticpool/modules.tf index 7e0411e..6c5206d 100644 --- a/cloud/azure/sql-elasticpool/modules.tf +++ b/cloud/azure/sql-elasticpool/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_sql-elasticpool" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/sql-elasticpool/monitors-sql-elasticpool.tf b/cloud/azure/sql-elasticpool/monitors-sql-elasticpool.tf index 3cea3cc..5b038d4 100644 --- a/cloud/azure/sql-elasticpool/monitors-sql-elasticpool.tf +++ b/cloud/azure/sql-elasticpool/monitors-sql-elasticpool.tf @@ -1,92 +1,90 @@ resource "datadog_monitor" "sql_elasticpool_cpu" { - count = "${var.cpu_enabled == "true" ? 1 : 0}" + count = var.cpu_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Elastic Pool CPU too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cpu_message, var.message)}" + message = coalesce(var.cpu_message, var.message) + type = "query alert" query = < ${var.cpu_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical = "${var.cpu_threshold_critical}" - warning = "${var.cpu_threshold_warning}" + thresholds = { + critical = var.cpu_threshold_critical + warning = var.cpu_threshold_warning } - notify_no_data = true - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = true + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform", "${var.cpu_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform", var.cpu_extra_tags] } resource "datadog_monitor" "sql_elasticpool_free_space_low" { - count = "${var.diskspace_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Elastic Pool high disk usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.diskspace_message, var.message)}" - + count = var.diskspace_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Elastic Pool high disk usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.diskspace_message, var.message) type = "query alert" query = < ${var.diskspace_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.diskspace_threshold_warning}" - critical = "${var.diskspace_threshold_critical}" - } +thresholds = { +warning = var.diskspace_threshold_warning +critical = var.diskspace_threshold_critical +} - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform", "${var.diskspace_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform", var.diskspace_extra_tags] } resource "datadog_monitor" "sql_elasticpool_dtu_consumption_high" { - count = "${var.dtu_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Elastic Pool DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.dtu_message, var.message)}" - +count = var.dtu_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Elastic Pool DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.dtu_message, var.message) type = "query alert" - query = < ${var.dtu_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.dtu_threshold_warning}" - critical = "${var.dtu_threshold_critical}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform", "${var.dtu_extra_tags}"] +thresholds = { +warning = var.dtu_threshold_warning +critical = var.dtu_threshold_critical } + +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform", var.dtu_extra_tags] +} + diff --git a/cloud/azure/sql-elasticpool/outputs.tf b/cloud/azure/sql-elasticpool/outputs.tf index f3c189d..fb40d2e 100644 --- a/cloud/azure/sql-elasticpool/outputs.tf +++ b/cloud/azure/sql-elasticpool/outputs.tf @@ -1,14 +1,15 @@ output "sql_elasticpool_cpu_id" { description = "id for monitor sql_elasticpool_cpu" - value = "${datadog_monitor.sql_elasticpool_cpu.*.id}" + value = datadog_monitor.sql_elasticpool_cpu.*.id } output "sql_elasticpool_free_space_low_id" { description = "id for monitor sql_elasticpool_free_space_low" - value = "${datadog_monitor.sql_elasticpool_free_space_low.*.id}" + value = datadog_monitor.sql_elasticpool_free_space_low.*.id } output "sql_elasticpool_dtu_consumption_high_id" { description = "id for monitor sql_elasticpool_dtu_consumption_high" - value = "${datadog_monitor.sql_elasticpool_dtu_consumption_high.*.id}" + value = datadog_monitor.sql_elasticpool_dtu_consumption_high.*.id } + diff --git a/cloud/azure/sql-elasticpool/versions.tf b/cloud/azure/sql-elasticpool/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/sql-elasticpool/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/storage/inputs.tf b/cloud/azure/storage/inputs.tf index 2214a8f..9f9d73a 100644 --- a/cloud/azure/storage/inputs.tf +++ b/cloud/azure/storage/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture environment" - type = "string" + type = string } # Global DataDog @@ -43,31 +43,31 @@ variable "filter_tags_custom_excluded" { variable "availability_enabled" { description = "Flag to enable Storage availability monitor" - type = "string" + type = string default = "true" } variable "availability_extra_tags" { description = "Extra tags for Storage availability monitor" - type = "list" + type = list(string) default = [] } variable "availability_message" { description = "Custom message for Storage availability monitor" - type = "string" + type = string default = "" } variable "availability_time_aggregator" { description = "Monitor aggregator for Storage availability [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "availability_timeframe" { description = "Monitor timeframe for Storage availability [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -83,31 +83,31 @@ variable "availability_threshold_warning" { variable "successful_requests_enabled" { description = "Flag to enable Storage sucessful requests monitor" - type = "string" + type = string default = "true" } variable "successful_requests_extra_tags" { description = "Extra tags for Storage sucessful requests monitor" - type = "list" + type = list(string) default = [] } variable "successful_requests_message" { description = "Custom message for Storage sucessful requests monitor" - type = "string" + type = string default = "" } variable "successful_requests_time_aggregator" { description = "Monitor aggregator for Storage sucessful requests [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "successful_requests_timeframe" { description = "Monitor timeframe for Storage sucessful requests [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -123,31 +123,31 @@ variable "successful_requests_threshold_warning" { variable "latency_enabled" { description = "Flag to enable Storage latency monitor" - type = "string" + type = string default = "true" } variable "latency_extra_tags" { description = "Extra tags for Storage latency monitor" - type = "list" + type = list(string) default = [] } variable "latency_message" { description = "Custom message for Storage latency monitor" - type = "string" + type = string default = "" } variable "latency_time_aggregator" { description = "Monitor aggregator for Storage latency [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "latency_timeframe" { description = "Monitor timeframe for Storage latency [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -163,31 +163,31 @@ variable "latency_threshold_warning" { variable "timeout_error_requests_enabled" { description = "Flag to enable Storage timeout monitor" - type = "string" + type = string default = "true" } variable "timeout_error_requests_extra_tags" { description = "Extra tags for Storage timeout monitor" - type = "list" + type = list(string) default = [] } variable "timeout_error_requests_message" { description = "Custom message for Storage timeout monitor" - type = "string" + type = string default = "" } variable "timeout_error_requests_time_aggregator" { description = "Monitor aggregator for Storage timeout [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "timeout_error_requests_timeframe" { description = "Monitor timeframe for Storage timeout [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -203,31 +203,31 @@ variable "timeout_error_requests_threshold_warning" { variable "network_error_requests_enabled" { description = "Flag to enable Storage network errors monitor" - type = "string" + type = string default = "true" } variable "network_error_requests_extra_tags" { description = "Extra tags for Storage network errors monitor" - type = "list" + type = list(string) default = [] } variable "network_error_requests_message" { description = "Custom message for Storage network errors monitor" - type = "string" + type = string default = "" } variable "network_error_requests_time_aggregator" { description = "Monitor aggregator for Storage network errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "network_error_requests_timeframe" { description = "Monitor timeframe for Storage network errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -243,31 +243,31 @@ variable "network_error_requests_threshold_warning" { variable "throttling_error_requests_enabled" { description = "Flag to enable Storage throttling error monitor" - type = "string" + type = string default = "true" } variable "throttling_error_requests_extra_tags" { description = "Extra tags for Storage throttling error monitor" - type = "list" + type = list(string) default = [] } variable "throttling_error_requests_message" { description = "Custom message for Storage throttling error monitor" - type = "string" + type = string default = "" } variable "throttling_error_requests_time_aggregator" { description = "Monitor aggregator for Storage throttling errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "throttling_error_requests_timeframe" { description = "Monitor timeframe for Storage throttling errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -283,31 +283,31 @@ variable "throttling_error_requests_threshold_warning" { variable "server_other_error_requests_enabled" { description = "Flag to enable Storage server other errors monitor" - type = "string" + type = string default = "true" } variable "server_other_error_requests_extra_tags" { description = "Extra tags for Storage server other errors monitor" - type = "list" + type = list(string) default = [] } variable "server_other_error_requests_message" { description = "Custom message for Storage server other errors monitor" - type = "string" + type = string default = "" } variable "server_other_error_requests_time_aggregator" { description = "Monitor aggregator for Storage other errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "server_other_error_requests_timeframe" { description = "Monitor timeframe for Storage server other errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -323,31 +323,31 @@ variable "server_other_error_requests_threshold_warning" { variable "client_other_error_requests_enabled" { description = "Flag to enable Storage other errors monitor" - type = "string" + type = string default = "true" } variable "client_other_error_requests_extra_tags" { description = "Extra tags for Storage other errors monitor" - type = "list" + type = list(string) default = [] } variable "client_other_error_requests_message" { description = "Custom message for Storage other errors monitor" - type = "string" + type = string default = "" } variable "client_other_error_requests_time_aggregator" { description = "Monitor aggregator for Storage other errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "client_other_error_requests_timeframe" { description = "Monitor timeframe for Storage other errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -363,31 +363,31 @@ variable "client_other_error_requests_threshold_warning" { variable "authorization_error_requests_enabled" { description = "Flag to enable Storage authorization errors monitor" - type = "string" + type = string default = "true" } variable "authorization_error_requests_extra_tags" { description = "Extra tags for Storage authorization errors monitor" - type = "list" + type = list(string) default = [] } variable "authorization_error_requests_message" { description = "Custom message for Storage authorization errors monitor" - type = "string" + type = string default = "" } variable "authorization_error_requests_time_aggregator" { description = "Monitor aggregator for Storage authorization errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "authorization_error_requests_timeframe" { description = "Monitor timeframe for Storage authorization errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -400,3 +400,4 @@ variable "authorization_error_requests_threshold_warning" { description = "Warning regarding acceptable percent of authorization error requests for a storage" default = 50 } + diff --git a/cloud/azure/storage/modules.tf b/cloud/azure/storage/modules.tf index 3a51cad..d60f90d 100644 --- a/cloud/azure/storage/modules.tf +++ b/cloud/azure/storage/modules.tf @@ -1,10 +1,11 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_storage" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded extra_tags = ["transaction_type:all"] } + diff --git a/cloud/azure/storage/monitors-azure-storage.tf b/cloud/azure/storage/monitors-azure-storage.tf index f5b6d92..c87b4da 100644 --- a/cloud/azure/storage/monitors-azure-storage.tf +++ b/cloud/azure/storage/monitors-azure-storage.tf @@ -1,269 +1,271 @@ resource "datadog_monitor" "availability" { - count = "${var.availability_enabled == "true" ? 1 : 0}" + count = var.availability_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage is down" - message = "${coalesce(var.availability_message, var.message)}" + message = coalesce(var.availability_message, var.message) + type = "query alert" query = < ${var.latency_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.latency_threshold_critical}" - warning = "${var.latency_threshold_warning}" - } +thresholds = { +critical = var.latency_threshold_critical +warning = var.latency_threshold_warning +} - type = "query alert" - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 +notify_no_data = false +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay +evaluation_delay = var.evaluation_delay +renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", "${var.latency_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.latency_extra_tags] } resource "datadog_monitor" "timeout_error_requests" { - count = "${var.timeout_error_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many timeout errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.timeout_error_requests_message, var.message)}" +count = var.timeout_error_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many timeout errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.timeout_error_requests_message, var.message) + type = "query alert" - query = < ${var.timeout_error_requests_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.timeout_error_requests_threshold_critical}" - warning = "${var.timeout_error_requests_threshold_warning}" + thresholds = { + critical = var.timeout_error_requests_threshold_critical + warning = var.timeout_error_requests_threshold_warning } - type = "query alert" notify_no_data = false notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", "${var.timeout_error_requests_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.timeout_error_requests_extra_tags] } resource "datadog_monitor" "network_error_requests" { - count = "${var.network_error_requests_enabled == "true" ? 1 : 0}" + count = var.network_error_requests_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many network errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.network_error_requests_message, var.message)}" + message = coalesce(var.network_error_requests_message, var.message) + type = "query alert" query = < ${var.network_error_requests_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.network_error_requests_threshold_critical}" - warning = "${var.network_error_requests_threshold_warning}" + thresholds = { + critical = var.network_error_requests_threshold_critical + warning = var.network_error_requests_threshold_warning } - type = "query alert" - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", "${var.network_error_requests_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.network_error_requests_extra_tags] } resource "datadog_monitor" "throttling_error_requests" { - count = "${var.throttling_error_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many throttling errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.throttling_error_requests_message, var.message)}" + count = var.throttling_error_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many throttling errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.throttling_error_requests_message, var.message) + type = "query alert" query = < ${var.throttling_error_requests_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.throttling_error_requests_threshold_critical}" - warning = "${var.throttling_error_requests_threshold_warning}" - } +thresholds = { +critical = var.throttling_error_requests_threshold_critical +warning = var.throttling_error_requests_threshold_warning +} - type = "query alert" - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 +notify_no_data = false +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay +evaluation_delay = var.evaluation_delay +renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", "${var.throttling_error_requests_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.throttling_error_requests_extra_tags] } resource "datadog_monitor" "server_other_error_requests" { - count = "${var.server_other_error_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many server_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.server_other_error_requests_message, var.message)}" +count = var.server_other_error_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many server_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.server_other_error_requests_message, var.message) + type = "query alert" - query = < ${var.server_other_error_requests_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.server_other_error_requests_threshold_critical}" - warning = "${var.server_other_error_requests_threshold_warning}" - } +thresholds = { +critical = var.server_other_error_requests_threshold_critical +warning = var.server_other_error_requests_threshold_warning +} - type = "query alert" - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 +notify_no_data = false +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay +evaluation_delay = var.evaluation_delay +renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", "${var.server_other_error_requests_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.server_other_error_requests_extra_tags] } resource "datadog_monitor" "client_other_error_requests" { - count = "${var.client_other_error_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many client_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.client_other_error_requests_message, var.message)}" +count = var.client_other_error_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many client_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.client_other_error_requests_message, var.message) + type = "query alert" - query = < ${var.client_other_error_requests_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.client_other_error_requests_threshold_critical}" - warning = "${var.client_other_error_requests_threshold_warning}" + thresholds = { + critical = var.client_other_error_requests_threshold_critical + warning = var.client_other_error_requests_threshold_warning } - type = "query alert" notify_no_data = false notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", "${var.client_other_error_requests_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.client_other_error_requests_extra_tags] } resource "datadog_monitor" "authorization_error_requests" { - count = "${var.authorization_error_requests_enabled == "true" ? 1 : 0}" + count = var.authorization_error_requests_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many authorization errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.authorization_error_requests_message, var.message)}" + message = coalesce(var.authorization_error_requests_message, var.message) + type = "query alert" query = < ${var.authorization_error_requests_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.authorization_error_requests_threshold_critical}" - warning = "${var.authorization_error_requests_threshold_warning}" + thresholds = { + critical = var.authorization_error_requests_threshold_critical + warning = var.authorization_error_requests_threshold_warning } - type = "query alert" - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", "${var.authorization_error_requests_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.authorization_error_requests_extra_tags] } + diff --git a/cloud/azure/storage/outputs.tf b/cloud/azure/storage/outputs.tf index 261c8f1..bc3bb1a 100644 --- a/cloud/azure/storage/outputs.tf +++ b/cloud/azure/storage/outputs.tf @@ -1,44 +1,45 @@ output "availability_id" { description = "id for monitor availability" - value = "${datadog_monitor.availability.*.id}" + value = datadog_monitor.availability.*.id } output "successful_requests_id" { description = "id for monitor successful_requests" - value = "${datadog_monitor.successful_requests.*.id}" + value = datadog_monitor.successful_requests.*.id } output "latency_id" { description = "id for monitor latency" - value = "${datadog_monitor.latency.*.id}" + value = datadog_monitor.latency.*.id } output "timeout_error_requests_id" { description = "id for monitor timeout_error_requests" - value = "${datadog_monitor.timeout_error_requests.*.id}" + value = datadog_monitor.timeout_error_requests.*.id } output "network_error_requests_id" { description = "id for monitor network_error_requests" - value = "${datadog_monitor.network_error_requests.*.id}" + value = datadog_monitor.network_error_requests.*.id } output "throttling_error_requests_id" { description = "id for monitor throttling_error_requests" - value = "${datadog_monitor.throttling_error_requests.*.id}" + value = datadog_monitor.throttling_error_requests.*.id } output "server_other_error_requests_id" { description = "id for monitor server_other_error_requests" - value = "${datadog_monitor.server_other_error_requests.*.id}" + value = datadog_monitor.server_other_error_requests.*.id } output "client_other_error_requests_id" { description = "id for monitor client_other_error_requests" - value = "${datadog_monitor.client_other_error_requests.*.id}" + value = datadog_monitor.client_other_error_requests.*.id } output "authorization_error_requests_id" { description = "id for monitor authorization_error_requests" - value = "${datadog_monitor.authorization_error_requests.*.id}" + value = datadog_monitor.authorization_error_requests.*.id } + diff --git a/cloud/azure/storage/versions.tf b/cloud/azure/storage/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/storage/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/stream-analytics/inputs.tf b/cloud/azure/stream-analytics/inputs.tf index 314bb1f..14b2687 100644 --- a/cloud/azure/stream-analytics/inputs.tf +++ b/cloud/azure/stream-analytics/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture environment" - type = "string" + type = string } # Global DataDog @@ -43,61 +43,61 @@ variable "filter_tags_custom_excluded" { variable "status_enabled" { description = "Flag to enable Stream Analytics status monitor" - type = "string" + type = string default = "true" } variable "status_extra_tags" { description = "Extra tags for Stream Analytics status monitor" - type = "list" + type = list(string) default = [] } variable "status_message" { description = "Custom message for Stream Analytics status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Stream Analytics status [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "status_timeframe" { description = "Monitor timeframe for Stream Analytics status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "su_utilization_enabled" { description = "Flag to enable Stream Analytics utilization monitor" - type = "string" + type = string default = "true" } variable "su_utilization_extra_tags" { description = "Extra tags for Stream Analytics utilization monitor" - type = "list" + type = list(string) default = [] } variable "su_utilization_message" { description = "Custom message for Stream Analytics utilization monitor" - type = "string" + type = string default = "" } variable "su_utilization_time_aggregator" { description = "Monitor aggregator for Stream Analytics utilization [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "su_utilization_timeframe" { description = "Monitor timeframe for Stream Analytics utilization [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -113,31 +113,31 @@ variable "su_utilization_threshold_critical" { variable "failed_function_requests_enabled" { description = "Flag to enable Stream Analytics failed requests monitor" - type = "string" + type = string default = "true" } variable "failed_function_requests_extra_tags" { description = "Extra tags for Stream Analytics failed requests monitor" - type = "list" + type = list(string) default = [] } variable "failed_function_requests_message" { description = "Custom message for Stream Analytics failed requests monitor" - type = "string" + type = string default = "" } variable "failed_function_requests_time_aggregator" { description = "Monitor aggregator for Stream Analytics failed requests [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "failed_function_requests_timeframe" { description = "Monitor timeframe for Stream Analytics failed requests [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -153,31 +153,31 @@ variable "failed_function_requests_threshold_critical" { variable "conversion_errors_enabled" { description = "Flag to enable Stream Analytics conversion errors monitor" - type = "string" + type = string default = "true" } variable "conversion_errors_extra_tags" { description = "Extra tags for Stream Analytics conversion errors monitor" - type = "list" + type = list(string) default = [] } variable "conversion_errors_message" { description = "Custom message for Stream Analytics conversion errors monitor" - type = "string" + type = string default = "" } variable "conversion_errors_time_aggregator" { description = "Monitor aggregator for Stream Analytics conversion errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "conversion_errors_timeframe" { description = "Monitor timeframe for Stream Analytics conversion errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -193,31 +193,31 @@ variable "conversion_errors_threshold_critical" { variable "runtime_errors_enabled" { description = "Flag to enable Stream Analytics runtime errors monitor" - type = "string" + type = string default = "true" } variable "runtime_errors_extra_tags" { description = "Extra tags for Stream Analytics runtime errors monitor" - type = "list" + type = list(string) default = [] } variable "runtime_errors_message" { description = "Custom message for Stream Analytics runtime errors monitor" - type = "string" + type = string default = "" } variable "runtime_errors_time_aggregator" { description = "Monitor aggregator for Stream Analytics runtime errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "runtime_errors_timeframe" { description = "Monitor timeframe for Stream Analytics runtime errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -230,3 +230,4 @@ variable "runtime_errors_threshold_critical" { description = "Runtime errors limit (critical threshold)" default = 10 } + diff --git a/cloud/azure/stream-analytics/modules.tf b/cloud/azure/stream-analytics/modules.tf index 2738684..868c6a9 100644 --- a/cloud/azure/stream-analytics/modules.tf +++ b/cloud/azure/stream-analytics/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_stream-analytics" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/stream-analytics/monitors-stream-analytics.tf b/cloud/azure/stream-analytics/monitors-stream-analytics.tf index f9ab56a..7c9e80d 100644 --- a/cloud/azure/stream-analytics/monitors-stream-analytics.tf +++ b/cloud/azure/stream-analytics/monitors-stream-analytics.tf @@ -1,150 +1,146 @@ resource "datadog_monitor" "status" { - count = "${var.status_enabled == "true" ? 1 : 0}" + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics is down" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.su_utilization_threshold_critical} - EOQ +EOQ - type = "query alert" +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" +thresholds = { +warning = var.su_utilization_threshold_warning +critical = var.su_utilization_threshold_critical +} - thresholds { - warning = "${var.su_utilization_threshold_warning}" - critical = "${var.su_utilization_threshold_critical}" - } - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", "${var.su_utilization_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", var.su_utilization_extra_tags] } resource "datadog_monitor" "failed_function_requests" { - count = "${var.failed_function_requests_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.failed_function_requests_message, var.message)}" +count = var.failed_function_requests_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.failed_function_requests_message, var.message) + type = "query alert" - query = < ${var.failed_function_requests_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.failed_function_requests_threshold_warning +critical = var.failed_function_requests_threshold_critical +} - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 60 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 60 +notify_audit = false +timeout_h = 1 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - thresholds { - warning = "${var.failed_function_requests_threshold_warning}" - critical = "${var.failed_function_requests_threshold_critical}" - } - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", "${var.failed_function_requests_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", var.failed_function_requests_extra_tags] } resource "datadog_monitor" "conversion_errors" { - count = "${var.conversion_errors_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many conversion errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.conversion_errors_message, var.message)}" +count = var.conversion_errors_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many conversion errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.conversion_errors_message, var.message) + type = "query alert" - query = < ${var.conversion_errors_threshold_critical} - EOQ +EOQ - type = "query alert" + thresholds = { + warning = var.conversion_errors_threshold_warning + critical = var.conversion_errors_threshold_critical + } notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" + evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 1 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" + new_host_delay = var.new_host_delay - thresholds { - warning = "${var.conversion_errors_threshold_warning}" - critical = "${var.conversion_errors_threshold_critical}" - } - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", "${var.conversion_errors_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", var.conversion_errors_extra_tags] } resource "datadog_monitor" "runtime_errors" { - count = "${var.runtime_errors_enabled == "true" ? 1 : 0}" + count = var.runtime_errors_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many runtime errors {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.runtime_errors_message, var.message)}" + message = coalesce(var.runtime_errors_message, var.message) + type = "query alert" query = < ${var.runtime_errors_threshold_critical} - EOQ +EOQ - type = "query alert" - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.runtime_errors_threshold_warning}" - critical = "${var.runtime_errors_threshold_critical}" + thresholds = { + warning = var.runtime_errors_threshold_warning + critical = var.runtime_errors_threshold_critical } - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", "${var.runtime_errors_extra_tags}"] + notify_no_data = false + evaluation_delay = var.evaluation_delay + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false + new_host_delay = var.new_host_delay + + tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", var.runtime_errors_extra_tags] } + diff --git a/cloud/azure/stream-analytics/outputs.tf b/cloud/azure/stream-analytics/outputs.tf index e0367f7..94129c7 100644 --- a/cloud/azure/stream-analytics/outputs.tf +++ b/cloud/azure/stream-analytics/outputs.tf @@ -1,24 +1,25 @@ output "status_id" { description = "id for monitor status" - value = "${datadog_monitor.status.*.id}" + value = datadog_monitor.status.*.id } output "su_utilization_id" { description = "id for monitor su_utilization" - value = "${datadog_monitor.su_utilization.*.id}" + value = datadog_monitor.su_utilization.*.id } output "failed_function_requests_id" { description = "id for monitor failed_function_requests" - value = "${datadog_monitor.failed_function_requests.*.id}" + value = datadog_monitor.failed_function_requests.*.id } output "conversion_errors_id" { description = "id for monitor conversion_errors" - value = "${datadog_monitor.conversion_errors.*.id}" + value = datadog_monitor.conversion_errors.*.id } output "runtime_errors_id" { description = "id for monitor runtime_errors" - value = "${datadog_monitor.runtime_errors.*.id}" + value = datadog_monitor.runtime_errors.*.id } + diff --git a/cloud/azure/stream-analytics/versions.tf b/cloud/azure/stream-analytics/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/azure/stream-analytics/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/azure/virtual-machine/inputs.tf b/cloud/azure/virtual-machine/inputs.tf index 485a86d..087c19f 100644 --- a/cloud/azure/virtual-machine/inputs.tf +++ b/cloud/azure/virtual-machine/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture environment" - type = "string" + type = string } # Global DataDog @@ -43,61 +43,61 @@ variable "filter_tags_custom_excluded" { variable "status_enabled" { description = "Flag to enable Virtual Machine status monitor" - type = "string" + type = string default = "true" } variable "status_extra_tags" { description = "Extra tags for Virtual Machine status monitor" - type = "list" + type = list(string) default = [] } variable "status_message" { description = "Custom message for Virtual Machine status monitor" - type = "string" + type = string default = "" } variable "status_time_aggregator" { description = "Monitor aggregator for Virtual Machine status [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "status_timeframe" { description = "Monitor timeframe for Virtual Machine status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "cpu_usage_enabled" { description = "Flag to enable Virtual Machine status monitor" - type = "string" + type = string default = "true" } variable "cpu_usage_extra_tags" { description = "Extra tags for Virtual Machine status monitor" - type = "list" + type = list(string) default = [] } variable "cpu_usage_message" { description = "Custom message for Virtual Machine CPU monitor" - type = "string" + type = string default = "" } variable "cpu_usage_time_aggregator" { description = "Monitor aggregator for Virtual Machine CPU [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cpu_usage_timeframe" { description = "Monitor timeframe for Virtual Machine CPU [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -113,31 +113,31 @@ variable "cpu_usage_threshold_critical" { variable "cpu_remaining_rate_enabled" { description = "Flag to enable Virtual Machine CPU remaining monitor" - type = "string" + type = string default = "true" } variable "cpu_remaining_rate_extra_tags" { description = "Extra tags for Virtual Machine CPU remaining monitor" - type = "list" + type = list(string) default = [] } variable "cpu_remaining_rate_message" { description = "Custom message for Virtual Machine CPU remaining monitor" - type = "string" + type = string default = "" } variable "cpu_remaining_rate_time_aggregator" { description = "Monitor aggregator for Virtual Machine CPU remaining [available values: min, max, sum or avg]" - type = "string" + type = string default = "min" } variable "cpu_remaining_rate_timeframe" { description = "Monitor timeframe for Virtual Machine CPU remaining [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -150,3 +150,4 @@ variable "cpu_remaining_rate_threshold_critical" { description = "Virtual Machine CPU rate limit (critical threshold)" default = 15 } + diff --git a/cloud/azure/virtual-machine/modules.tf b/cloud/azure/virtual-machine/modules.tf index 9967458..8be2bf9 100644 --- a/cloud/azure/virtual-machine/modules.tf +++ b/cloud/azure/virtual-machine/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "azure_virtual-machine" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/cloud/azure/virtual-machine/monitors-virtual-machine.tf b/cloud/azure/virtual-machine/monitors-virtual-machine.tf index aaeddc7..3ed46e6 100644 --- a/cloud/azure/virtual-machine/monitors-virtual-machine.tf +++ b/cloud/azure/virtual-machine/monitors-virtual-machine.tf @@ -1,91 +1,88 @@ resource "datadog_monitor" "virtualmachine_status" { - count = "${var.status_enabled == "true" ? 1 : 0}" - + count = var.status_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Virtual Machine is unreachable" - message = "${coalesce(var.status_message, var.message)}" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.cpu_usage_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +critical = var.cpu_usage_threshold_critical +warning = var.cpu_usage_threshold_warning +} - thresholds { - critical = "${var.cpu_usage_threshold_critical}" - warning = "${var.cpu_usage_threshold_warning}" - } +notify_no_data = false +evaluation_delay = var.evaluation_delay +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false +new_host_delay = var.new_host_delay - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform", "${var.cpu_usage_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform", var.cpu_usage_extra_tags] } resource "datadog_monitor" "virtualmachine_credit_cpu_remaining_too_low" { - count = "${var.cpu_remaining_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Virtual Machine credit CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cpu_remaining_rate_message, var.message)}" +count = var.cpu_remaining_rate_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Virtual Machine credit CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.cpu_remaining_rate_message, var.message) + type = "query alert" - query = < ${var.concurrent_queries_threshold_critical} - EOQ + avg(${var.concurrent_queries_timeframe}): + default(avg:gcp.bigquery.query.count{${var.filter_tags}}, 0) + > ${var.concurrent_queries_threshold_critical} +EOQ - thresholds { - warning = "${var.concurrent_queries_threshold_warning}" - critical = "${var.concurrent_queries_threshold_critical}" + thresholds = { + warning = var.concurrent_queries_threshold_warning + critical = var.concurrent_queries_threshold_critical } - include_tags = true - notify_no_data = false + include_tags = true + notify_no_data = false require_full_window = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - locked = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", "${var.concurrent_queries_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.concurrent_queries_extra_tags] } # # Execution Time # resource "datadog_monitor" "execution_time" { - count = "${var.execution_time_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Execution Time {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" - message = "${coalesce(var.execution_time_message, var.message)}" - + count = var.execution_time_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Execution Time {{#is_alert}}{{{comparator}}} {{threshold}}s ({{value}}s){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}s ({{value}}s){{/is_warning}}" + message = coalesce(var.execution_time_message, var.message) type = "query alert" query = < ${var.execution_time_threshold_critical} - EOQ + avg(${var.execution_time_timeframe}): + default(avg:gcp.bigquery.query.execution_times.avg{${var.filter_tags}}, 0) + > ${var.execution_time_threshold_critical} +EOQ - thresholds { - warning = "${var.execution_time_threshold_warning}" - critical = "${var.execution_time_threshold_critical}" - } +thresholds = { +warning = var.execution_time_threshold_warning +critical = var.execution_time_threshold_critical +} - include_tags = true - notify_no_data = false - require_full_window = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - locked = false +include_tags = true +notify_no_data = false +require_full_window = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +locked = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", "${var.execution_time_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.execution_time_extra_tags] } # # Scanned Bytes # resource "datadog_monitor" "scanned_bytes" { - count = "${var.scanned_bytes_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" - message = "${coalesce(var.scanned_bytes_message, var.message)}" - +count = var.scanned_bytes_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" +message = coalesce(var.scanned_bytes_message, var.message) type = "query alert" - query = < ${var.scanned_bytes_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.scanned_bytes_threshold_warning}" - critical = "${var.scanned_bytes_threshold_critical}" - } +thresholds = { +warning = var.scanned_bytes_threshold_warning +critical = var.scanned_bytes_threshold_critical +} - include_tags = true - notify_no_data = false - require_full_window = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - locked = false +include_tags = true +notify_no_data = false +require_full_window = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +locked = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", "${var.scanned_bytes_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.scanned_bytes_extra_tags] } # # Scanned Bytes Billed # resource "datadog_monitor" "scanned_bytes_billed" { - count = "${var.scanned_bytes_billed_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes Billed {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" - message = "${coalesce(var.scanned_bytes_billed_message, var.message)}" - +count = var.scanned_bytes_billed_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes Billed {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" +message = coalesce(var.scanned_bytes_billed_message, var.message) type = "query alert" - query = < ${var.scanned_bytes_billed_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.scanned_bytes_billed_threshold_warning}" - critical = "${var.scanned_bytes_billed_threshold_critical}" + thresholds = { + warning = var.scanned_bytes_billed_threshold_warning + critical = var.scanned_bytes_billed_threshold_critical } include_tags = true @@ -128,132 +128,133 @@ resource "datadog_monitor" "scanned_bytes_billed" { timeout_h = 0 locked = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", "${var.scanned_bytes_billed_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.scanned_bytes_billed_extra_tags] } # # Available Slots # resource "datadog_monitor" "available_slots" { - count = "${var.available_slots_enabled == "true" ? 1 : 0}" + count = var.available_slots_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Available Slots {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.available_slots_message, var.message)}" - + message = coalesce(var.available_slots_message, var.message) type = "metric alert" query = < ${var.stored_bytes_threshold_critical} - EOQ + avg(${var.stored_bytes_timeframe}): + default(avg:gcp.bigquery.storage.stored_bytes{${var.filter_tags}} by {dataset_id,table}, 0) + > ${var.stored_bytes_threshold_critical} +EOQ - thresholds { - warning = "${var.stored_bytes_threshold_warning}" - critical = "${var.stored_bytes_threshold_critical}" - } - include_tags = true - notify_no_data = false - require_full_window = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - locked = false +thresholds = { +warning = var.stored_bytes_threshold_warning +critical = var.stored_bytes_threshold_critical +} - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +include_tags = true +notify_no_data = false +require_full_window = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +locked = false - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", "${var.stored_bytes_extra_tags}"] +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.stored_bytes_extra_tags] } # # Table Count # resource "datadog_monitor" "table_count" { - count = "${var.table_count_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Table Count {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.table_count_message, var.message)}" +count = var.table_count_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Table Count {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" +message = coalesce(var.table_count_message, var.message) +type = "metric alert" - type = "metric alert" - - query = < ${var.table_count_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.table_count_threshold_warning}" - critical = "${var.table_count_threshold_critical}" - } +thresholds = { +warning = var.table_count_threshold_warning +critical = var.table_count_threshold_critical +} - include_tags = true - notify_no_data = false - require_full_window = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - locked = false +include_tags = true +notify_no_data = false +require_full_window = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +locked = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", "${var.table_count_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.table_count_extra_tags] } # # Uploaded Bytes # resource "datadog_monitor" "uploaded_bytes" { - count = "${var.uploaded_bytes_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Uploaded Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" - message = "${coalesce(var.uploaded_bytes_message, var.message)}" - +count = var.uploaded_bytes_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Uploaded Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" +message = coalesce(var.uploaded_bytes_message, var.message) type = "query alert" - query = < ${var.uploaded_bytes_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.uploaded_bytes_threshold_warning}" - critical = "${var.uploaded_bytes_threshold_critical}" + thresholds = { + warning = var.uploaded_bytes_threshold_warning + critical = var.uploaded_bytes_threshold_critical } include_tags = true @@ -264,42 +265,43 @@ resource "datadog_monitor" "uploaded_bytes" { timeout_h = 0 locked = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", "${var.uploaded_bytes_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.uploaded_bytes_extra_tags] } # # Uploaded Bytes Billed # resource "datadog_monitor" "uploaded_bytes_billed" { - count = "${var.uploaded_bytes_billed_enabled == "true" ? 1 : 0}" + count = var.uploaded_bytes_billed_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Uploaded Bytes Billed {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" - message = "${coalesce(var.uploaded_bytes_billed_message, var.message)}" - + message = coalesce(var.uploaded_bytes_billed_message, var.message) type = "query alert" query = < ${var.uploaded_bytes_billed_threshold_critical} - EOQ + avg(${var.uploaded_bytes_billed_timeframe}): + default(avg:gcp.bigquery.storage.uploaded_bytes_billed{${var.filter_tags}} by {dataset_id,table}, 0) + > ${var.uploaded_bytes_billed_threshold_critical} +EOQ - thresholds { - warning = "${var.uploaded_bytes_billed_threshold_warning}" - critical = "${var.uploaded_bytes_billed_threshold_critical}" + thresholds = { + warning = var.uploaded_bytes_billed_threshold_warning + critical = var.uploaded_bytes_billed_threshold_critical } - include_tags = true - notify_no_data = false + include_tags = true + notify_no_data = false require_full_window = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - locked = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", "${var.uploaded_bytes_billed_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.uploaded_bytes_billed_extra_tags] } + diff --git a/cloud/gcp/big-query/outputs.tf b/cloud/gcp/big-query/outputs.tf index be9de5f..e38f8d1 100644 --- a/cloud/gcp/big-query/outputs.tf +++ b/cloud/gcp/big-query/outputs.tf @@ -1,44 +1,45 @@ output "concurrent_queries_id" { description = "id for monitor concurrent_queries" - value = "${datadog_monitor.concurrent_queries.*.id}" + value = datadog_monitor.concurrent_queries.*.id } output "execution_time_id" { description = "id for monitor execution_time" - value = "${datadog_monitor.execution_time.*.id}" + value = datadog_monitor.execution_time.*.id } output "scanned_bytes_id" { description = "id for monitor scanned_bytes" - value = "${datadog_monitor.scanned_bytes.*.id}" + value = datadog_monitor.scanned_bytes.*.id } output "scanned_bytes_billed_id" { description = "id for monitor scanned_bytes_billed" - value = "${datadog_monitor.scanned_bytes_billed.*.id}" + value = datadog_monitor.scanned_bytes_billed.*.id } output "available_slots_id" { description = "id for monitor available_slots" - value = "${datadog_monitor.available_slots.*.id}" + value = datadog_monitor.available_slots.*.id } output "stored_bytes_id" { description = "id for monitor stored_bytes" - value = "${datadog_monitor.stored_bytes.*.id}" + value = datadog_monitor.stored_bytes.*.id } output "table_count_id" { description = "id for monitor table_count" - value = "${datadog_monitor.table_count.*.id}" + value = datadog_monitor.table_count.*.id } output "uploaded_bytes_id" { description = "id for monitor uploaded_bytes" - value = "${datadog_monitor.uploaded_bytes.*.id}" + value = datadog_monitor.uploaded_bytes.*.id } output "uploaded_bytes_billed_id" { description = "id for monitor uploaded_bytes_billed" - value = "${datadog_monitor.uploaded_bytes_billed.*.id}" + value = datadog_monitor.uploaded_bytes_billed.*.id } + diff --git a/cloud/gcp/big-query/versions.tf b/cloud/gcp/big-query/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/gcp/big-query/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/gcp/cloud-sql/common/inputs.tf b/cloud/gcp/cloud-sql/common/inputs.tf index 74743f8..9ee91df 100644 --- a/cloud/gcp/cloud-sql/common/inputs.tf +++ b/cloud/gcp/cloud-sql/common/inputs.tf @@ -3,7 +3,7 @@ # variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags" { @@ -36,43 +36,43 @@ variable "prefix_slug" { variable "cpu_utilization_message" { description = "Custom message for the CPU Utilization monitor" - type = "string" + type = string default = "" } variable "cpu_utilization_time_aggregator" { description = "Time aggregator for the CPU Utilization monitor" - type = "string" + type = string default = "avg" } variable "cpu_utilization_timeframe" { description = "Timeframe for the CPU Utilization monitor" - type = "string" + type = string default = "last_15m" } variable "cpu_utilization_threshold_warning" { description = "CPU Utilization in percentage (warning threshold)" - type = "string" + type = string default = 80 } variable "cpu_utilization_threshold_critical" { description = "CPU Utilization in percentage (critical threshold)" - type = "string" + type = string default = 90 } variable "cpu_utilization_enabled" { description = "Flag to enable GCP Cloud SQL CPU Utilization monitor" - type = "string" + type = string default = "true" } variable "cpu_utilization_extra_tags" { description = "Extra tags for GCP Cloud SQL CPU Utilization monitor" - type = "list" + type = list(string) default = [] } @@ -82,43 +82,43 @@ variable "cpu_utilization_extra_tags" { variable "disk_utilization_message" { description = "Custom message for the Disk Utilization monitor" - type = "string" + type = string default = "" } variable "disk_utilization_time_aggregator" { description = "Time aggregator for the Disk Utilization monitor" - type = "string" + type = string default = "avg" } variable "disk_utilization_timeframe" { description = "Timeframe for the Disk Utilization monitor" - type = "string" + type = string default = "last_5m" } variable "disk_utilization_threshold_warning" { description = "Disk Utilization in percentage (warning threshold)" - type = "string" + type = string default = 80 } variable "disk_utilization_threshold_critical" { description = "Disk Utilization in percentage (critical threshold)" - type = "string" + type = string default = 90 } variable "disk_utilization_enabled" { description = "Flag to enable GCP Cloud SQL Disk Utilization monitor" - type = "string" + type = string default = "true" } variable "disk_utilization_extra_tags" { description = "Extra tags for GCP Cloud SQL CPU Utilization monitor" - type = "list" + type = list(string) default = [] } @@ -128,79 +128,79 @@ variable "disk_utilization_extra_tags" { variable "disk_utilization_forecast_message" { description = "Custom message for the Disk Utilization Forecast monitor" - type = "string" + type = string default = "" } variable "disk_utilization_forecast_time_aggregator" { description = "Time aggregator for the Disk Utilization Forecast monitor" - type = "string" + type = string default = "max" } variable "disk_utilization_forecast_timeframe" { description = "Timeframe for the Disk Utilization Forecast monitor" - type = "string" + type = string default = "next_1w" } variable "disk_utilization_forecast_algorithm" { description = "Algorithm for the Disk Utilization Forecast monitor" - type = "string" + type = string default = "linear" } variable "disk_utilization_forecast_deviations" { description = "Deviations for the Disk Utilization Forecast monitor" - type = "string" + type = string default = 1 } variable "disk_utilization_forecast_interval" { description = "Interval for the Disk Utilization Forecast monitor" - type = "string" + type = string default = "60m" } variable "disk_utilization_forecast_linear_history" { description = "History for the Disk Utilization Forecast monitor" - type = "string" + type = string default = "3d" } variable "disk_utilization_forecast_linear_model" { description = "Model for the Disk Utilization Forecast monitor" - type = "string" + type = string default = "default" } variable "disk_utilization_forecast_seasonal_seasonality" { description = "Seasonality for the Disk Utilization Forecast monitor" - type = "string" + type = string default = "weekly" } variable "disk_utilization_forecast_threshold_critical" { description = "Disk Utilization Forecast in percentage (critical threshold)" - type = "string" + type = string default = 80 } variable "disk_utilization_forecast_threshold_critical_recovery" { description = "Disk Utilization Forecast in percentage (recovery threshold)" - type = "string" + type = string default = 72 } variable "disk_utilization_forecast_enabled" { description = "Flag to enable GCP Cloud SQL Disk Utilization Forecast monitor" - type = "string" + type = string default = "true" } variable "disk_utilization_forecast_extra_tags" { description = "Extra tags for GCP Cloud SQL Disk Utilization Forecast monitor" - type = "list" + type = list(string) default = [] } @@ -235,13 +235,13 @@ variable "memory_utilization_threshold_critical" { variable "memory_utilization_enabled" { description = "Flag to enable GCP Cloud SQL Memory Utilization monitor" - type = "string" + type = string default = "true" } variable "memory_utilization_extra_tags" { description = "Extra tags for GCP Cloud SQL Memory Utilization monitor" - type = "list" + type = list(string) default = [] } @@ -266,37 +266,37 @@ variable "memory_utilization_forecast_timeframe" { variable "memory_utilization_forecast_algorithm" { description = "Algorithm for the Memory Utilization Forecast monitor" - type = "string" + type = string default = "linear" } variable "memory_utilization_forecast_deviations" { description = "Deviations for the Memory Utilization Forecast monitor" - type = "string" + type = string default = 1 } variable "memory_utilization_forecast_interval" { description = "Interval for the Memory Utilization Forecast monitor" - type = "string" + type = string default = "30m" } variable "memory_utilization_forecast_linear_history" { description = "History for the Memory Utilization Forecast monitor" - type = "string" + type = string default = "12h" } variable "memory_utilization_forecast_linear_model" { description = "Model for the Memory Utilization Forecast monitor" - type = "string" + type = string default = "default" } variable "memory_utilization_forecast_seasonal_seasonality" { description = "Seasonality for the Memory Utilization Forecast monitor" - type = "string" + type = string default = "weekly" } @@ -312,13 +312,13 @@ variable "memory_utilization_forecast_threshold_critical_recovery" { variable "memory_utilization_forecast_enabled" { description = "Flag to enable GCP Cloud SQL Memory Utilization Forecast monitor" - type = "string" + type = string default = "true" } variable "memory_utilization_forecast_extra_tags" { description = "Extra tags for GCP Cloud SQL Memory Utilization Forecast monitor" - type = "list" + type = list(string) default = [] } @@ -328,36 +328,37 @@ variable "memory_utilization_forecast_extra_tags" { variable "failover_unavailable_message" { description = "Custom message for the Failover Unavailable monitor" - type = "string" + type = string default = "" } variable "failover_unavailable_time_aggregator" { description = "Time aggreggator for the Failover Unavailable monitor" - type = "string" + type = string default = "max" } variable "failover_unavailable_timeframe" { description = "Timeframe for the Failover Unavailable monitor" - type = "string" + type = string default = "last_10m" } variable "failover_unavailable_threshold_critical" { description = "Failover Unavailable critical threshold" - type = "string" + type = string default = 0 } variable "failover_unavailable_enabled" { description = "Flag to enable GCP Cloud SQL Failover Unavailable monitor" - type = "string" + type = string default = "true" } variable "failover_unavailable_extra_tags" { description = "Extra tags for GCP Cloud SQL Failover Unavailable monitor" - type = "list" + type = list(string) default = [] } + diff --git a/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf b/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf index c422129..c712095 100644 --- a/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf +++ b/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf @@ -2,100 +2,102 @@ # CPU Utilization # resource "datadog_monitor" "cpu_utilization" { - count = "${var.cpu_utilization_enabled == "true" ? 1 : 0}" + count = var.cpu_utilization_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL CPU Utilization {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cpu_utilization_message, var.message)}" - + message = coalesce(var.cpu_utilization_message, var.message) type = "query alert" query = < ${var.cpu_utilization_threshold_critical} - EOQ + ${var.cpu_utilization_time_aggregator}(${var.cpu_utilization_timeframe}): + avg:gcp.cloudsql.database.cpu.utilization{${var.filter_tags}} by {database_id} * 100 + > ${var.cpu_utilization_threshold_critical} +EOQ - thresholds { - warning = "${var.cpu_utilization_threshold_warning}" - critical = "${var.cpu_utilization_threshold_critical}" + thresholds = { + warning = var.cpu_utilization_threshold_warning + critical = var.cpu_utilization_threshold_critical } - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = false notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "${var.cpu_utilization_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.cpu_utilization_extra_tags] } # # Disk Utilization # resource "datadog_monitor" "disk_utilization" { - count = "${var.disk_utilization_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Disk Utilization {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.disk_utilization_message, var.message)}" - + count = var.disk_utilization_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Disk Utilization {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.disk_utilization_message, var.message) type = "query alert" query = < ${var.disk_utilization_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.disk_utilization_threshold_warning}" - critical = "${var.disk_utilization_threshold_critical}" - } +thresholds = { +warning = var.disk_utilization_threshold_warning +critical = var.disk_utilization_threshold_critical +} - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = true - renotify_interval = 0 +notify_audit = false +locked = false +timeout_h = 0 +include_tags = true +require_full_window = false +notify_no_data = true +renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "${var.disk_utilization_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.disk_utilization_extra_tags] } # # Disk Utilization Forecast # resource "datadog_monitor" "disk_utilization_forecast" { - count = "${var.disk_utilization_forecast_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Disk Utilization could reach {{#is_alert}}{{threshold}}%{{/is_alert}} in a near future" - message = "${coalesce(var.disk_utilization_forecast_message, var.message)}" - +count = var.disk_utilization_forecast_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Disk Utilization could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" +message = coalesce(var.disk_utilization_forecast_message, var.message) type = "query alert" - query = <= ${var.disk_utilization_forecast_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.disk_utilization_forecast_threshold_critical}" - critical_recovery = "${var.disk_utilization_forecast_threshold_critical_recovery}" + thresholds = { + critical = var.disk_utilization_forecast_threshold_critical + critical_recovery = var.disk_utilization_forecast_threshold_critical_recovery } notify_audit = false @@ -106,121 +108,126 @@ resource "datadog_monitor" "disk_utilization_forecast" { notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "${var.disk_utilization_forecast_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.disk_utilization_forecast_extra_tags] } # # Memory Utilization # resource "datadog_monitor" "memory_utilization" { - count = "${var.memory_utilization_enabled == "true" ? 1 : 0}" + count = var.memory_utilization_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Memory Utilization {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.memory_utilization_message, var.message)}" - + message = coalesce(var.memory_utilization_message, var.message) type = "query alert" query = < ${var.memory_utilization_threshold_critical} - EOQ + ${var.memory_utilization_time_aggregator}(${var.memory_utilization_timeframe}): + avg:gcp.cloudsql.database.memory.utilization{${var.filter_tags}} by {database_id} * 100 + > ${var.memory_utilization_threshold_critical} +EOQ - thresholds { - warning = "${var.memory_utilization_threshold_warning}" - critical = "${var.memory_utilization_threshold_critical}" + thresholds = { + warning = var.memory_utilization_threshold_warning + critical = var.memory_utilization_threshold_critical } - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = false notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "${var.memory_utilization_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.memory_utilization_extra_tags] } # # Memory Utilization Forecast # resource "datadog_monitor" "memory_utilization_forecast" { - count = "${var.memory_utilization_forecast_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Memory Utilization could reach {{#is_alert}}{{threshold}}%{{/is_alert}} in a near future" - message = "${coalesce(var.memory_utilization_forecast_message, var.message)}" - + count = var.memory_utilization_forecast_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Memory Utilization could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" + message = coalesce(var.memory_utilization_forecast_message, var.message) type = "query alert" query = <= ${var.memory_utilization_forecast_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.memory_utilization_forecast_threshold_critical}" - critical_recovery = "${var.memory_utilization_forecast_threshold_critical_recovery}" - } + thresholds = { + critical = var.memory_utilization_forecast_threshold_critical + critical_recovery = var.memory_utilization_forecast_threshold_critical_recovery + } - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = false - renotify_interval = 0 + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = false + renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "${var.memory_utilization_forecast_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.memory_utilization_forecast_extra_tags] } # # Failover Unavailable # resource "datadog_monitor" "failover_unavailable" { - count = "${var.failover_unavailable_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Failover Unavailable" - message = "${coalesce(var.failover_unavailable_message, var.message)}" +count = var.failover_unavailable_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Failover Unavailable" +message = coalesce(var.failover_unavailable_message, var.message) - type = "metric alert" +type = "metric alert" - query = < ${var.replication_lag_threshold_critical} - EOQ + ${var.replication_lag_time_aggregator}(${var.replication_lag_timeframe}): + avg:gcp.cloudsql.database.mysql.replication.seconds_behind_master{${var.filter_tags}} by {database_id} + > ${var.replication_lag_threshold_critical} +EOQ - thresholds { - critical = "${var.replication_lag_threshold_critical}" - warning = "${var.replication_lag_threshold_warning}" + thresholds = { + critical = var.replication_lag_threshold_critical + warning = var.replication_lag_threshold_warning } - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = false - notify_no_data = true - renotify_interval = 0 + notify_no_data = true + renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "engine:mysql", "${var.replication_lag_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "engine:mysql", var.replication_lag_extra_tags] } + diff --git a/cloud/gcp/cloud-sql/mysql/outputs.tf b/cloud/gcp/cloud-sql/mysql/outputs.tf index e8e24fd..3134033 100644 --- a/cloud/gcp/cloud-sql/mysql/outputs.tf +++ b/cloud/gcp/cloud-sql/mysql/outputs.tf @@ -1,4 +1,5 @@ output "replication_lag_id" { description = "id for monitor replication_lag" - value = "${datadog_monitor.replication_lag.*.id}" + value = datadog_monitor.replication_lag.*.id } + diff --git a/cloud/gcp/cloud-sql/mysql/versions.tf b/cloud/gcp/cloud-sql/mysql/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/gcp/cloud-sql/mysql/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/gcp/gce/instance/inputs.tf b/cloud/gcp/gce/instance/inputs.tf index 0277a47..119a755 100644 --- a/cloud/gcp/gce/instance/inputs.tf +++ b/cloud/gcp/gce/instance/inputs.tf @@ -3,7 +3,7 @@ # variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags" { @@ -36,43 +36,43 @@ variable "prefix_slug" { variable "cpu_utilization_message" { description = "Custom message for the CPU Utilization monitor" - type = "string" + type = string default = "" } variable "cpu_utilization_time_aggregator" { description = "Time aggregator for the CPU Utilization monitor" - type = "string" + type = string default = "avg" } variable "cpu_utilization_timeframe" { description = "Timeframe for the CPU Utilization monitor" - type = "string" + type = string default = "last_15m" } variable "cpu_utilization_threshold_warning" { description = "CPU Utilization in percentage (warning threshold)" - type = "string" + type = string default = 80 } variable "cpu_utilization_threshold_critical" { description = "CPU Utilization in percentage (critical threshold)" - type = "string" + type = string default = 90 } variable "cpu_utilization_enabled" { description = "Flag to enable CPU Utilization monitor" - type = "string" + type = string default = "true" } variable "cpu_utilization_extra_tags" { description = "Extra tags for CPU Utilization monitor" - type = "list" + type = list(string) default = [] } @@ -82,49 +82,49 @@ variable "cpu_utilization_extra_tags" { variable "disk_throttled_bps_message" { description = "Custom message for the Disk Throttled Bps monitor" - type = "string" + type = string default = "" } variable "disk_throttled_bps_time_aggregator" { description = "Time aggregator for the Disk Throttled Bps monitor" - type = "string" + type = string default = "min" } variable "disk_throttled_bps_timeframe" { description = "Timeframe for the Disk Throttled Bps monitor" - type = "string" + type = string default = "last_15m" } variable "disk_throttled_bps_threshold_warning" { description = "Disk Throttled Bps in percentage (warning threshold)" - type = "string" + type = string default = 30 } variable "disk_throttled_bps_threshold_critical" { description = "Disk Throttled Bps in percentage (critical threshold)" - type = "string" + type = string default = 50 } variable "disk_throttled_bps_enabled" { description = "Flag to enable Disk Throttled Bps monitor" - type = "string" + type = string default = "true" } variable "disk_throttled_bps_extra_tags" { description = "Extra tags for Disk Throttled Bps monitor" - type = "list" + type = list(string) default = [] } variable "disk_throttled_bps_notify_no_data" { description = "Flag to enable notification for no data on Disk Throttled Bps monitor" - type = "string" + type = string default = "false" } @@ -134,48 +134,49 @@ variable "disk_throttled_bps_notify_no_data" { variable "disk_throttled_ops_message" { description = "Custom message for the Disk Throttled OPS monitor" - type = "string" + type = string default = "" } variable "disk_throttled_ops_time_aggregator" { description = "Time aggregator for the Disk Throttled OPS monitor" - type = "string" + type = string default = "min" } variable "disk_throttled_ops_timeframe" { description = "Timeframe for the Disk Throttled OPS monitor" - type = "string" + type = string default = "last_15m" } variable "disk_throttled_ops_threshold_warning" { description = "Disk Throttled OPS in percentage (warning threshold)" - type = "string" + type = string default = 30 } variable "disk_throttled_ops_threshold_critical" { description = "Disk Throttled OPS in percentage (critical threshold)" - type = "string" + type = string default = 50 } variable "disk_throttled_ops_enabled" { description = "Flag to enable Disk Throttled OPS monitor" - type = "string" + type = string default = "true" } variable "disk_throttled_ops_extra_tags" { description = "Extra tags for Disk Throttled OPS monitor" - type = "list" + type = list(string) default = [] } variable "disk_throttled_ops_notify_no_data" { description = "Flag to enable notification for no data on Disk Throttled OPS monitor" - type = "string" + type = string default = "false" } + diff --git a/cloud/gcp/gce/instance/monitors-gce-instance.tf b/cloud/gcp/gce/instance/monitors-gce-instance.tf index b23d8c3..808bc4a 100644 --- a/cloud/gcp/gce/instance/monitors-gce-instance.tf +++ b/cloud/gcp/gce/instance/monitors-gce-instance.tf @@ -2,45 +2,43 @@ # CPU Utilization # resource "datadog_monitor" "cpu_utilization" { - count = "${var.cpu_utilization_enabled == "true" ? 1 : 0}" + count = var.cpu_utilization_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Compute Engine instance CPU Utilization {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cpu_utilization_message, var.message)}" - + message = coalesce(var.cpu_utilization_message, var.message) type = "query alert" query = < ${var.cpu_utilization_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.cpu_utilization_threshold_warning}" - critical = "${var.cpu_utilization_threshold_critical}" + thresholds = { + warning = var.cpu_utilization_threshold_warning + critical = var.cpu_utilization_threshold_critical } - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = false - notify_no_data = true - renotify_interval = 0 + notify_no_data = true + renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform", "${var.cpu_utilization_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform", var.cpu_utilization_extra_tags] } # # Disk Throttled Bps # resource "datadog_monitor" "disk_throttled_bps" { - count = "${var.disk_throttled_bps_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Compute Engine instance Disk Throttled Bps {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.disk_throttled_bps_message, var.message)}" - + count = var.disk_throttled_bps_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Compute Engine instance Disk Throttled Bps {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.disk_throttled_bps_message, var.message) type = "query alert" query = < ${var.disk_throttled_bps_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.disk_throttled_bps_threshold_warning}" - critical = "${var.disk_throttled_bps_threshold_critical}" - } +thresholds = { +warning = var.disk_throttled_bps_threshold_warning +critical = var.disk_throttled_bps_threshold_critical +} - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = "${var.disk_throttled_bps_notify_no_data}" - renotify_interval = 0 +notify_audit = false +locked = false +timeout_h = 0 +include_tags = true +require_full_window = false +notify_no_data = var.disk_throttled_bps_notify_no_data +renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform", "${var.disk_throttled_bps_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform", var.disk_throttled_bps_extra_tags] } # # Disk Throttled OPS # resource "datadog_monitor" "disk_throttled_ops" { - count = "${var.disk_throttled_ops_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Compute Engine instance Disk Throttled OPS {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.disk_throttled_ops_message, var.message)}" - +count = var.disk_throttled_ops_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Compute Engine instance Disk Throttled OPS {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.disk_throttled_ops_message, var.message) type = "query alert" - query = < ${var.disk_throttled_ops_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.disk_throttled_ops_threshold_warning}" - critical = "${var.disk_throttled_ops_threshold_critical}" - } - - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = "${var.disk_throttled_ops_notify_no_data}" - renotify_interval = 0 - - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform", "${var.disk_throttled_ops_extra_tags}"] +thresholds = { +warning = var.disk_throttled_ops_threshold_warning +critical = var.disk_throttled_ops_threshold_critical } + +notify_audit = false +locked = false +timeout_h = 0 +include_tags = true +require_full_window = false +notify_no_data = var.disk_throttled_ops_notify_no_data +renotify_interval = 0 + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform", var.disk_throttled_ops_extra_tags] +} + diff --git a/cloud/gcp/gce/instance/outputs.tf b/cloud/gcp/gce/instance/outputs.tf index 04a5c63..002b395 100644 --- a/cloud/gcp/gce/instance/outputs.tf +++ b/cloud/gcp/gce/instance/outputs.tf @@ -1,14 +1,15 @@ output "cpu_utilization_id" { description = "id for monitor cpu_utilization" - value = "${datadog_monitor.cpu_utilization.*.id}" + value = datadog_monitor.cpu_utilization.*.id } output "disk_throttled_bps_id" { description = "id for monitor disk_throttled_bps" - value = "${datadog_monitor.disk_throttled_bps.*.id}" + value = datadog_monitor.disk_throttled_bps.*.id } output "disk_throttled_ops_id" { description = "id for monitor disk_throttled_ops" - value = "${datadog_monitor.disk_throttled_ops.*.id}" + value = datadog_monitor.disk_throttled_ops.*.id } + diff --git a/cloud/gcp/gce/instance/versions.tf b/cloud/gcp/gce/instance/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/gcp/gce/instance/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/gcp/lb/inputs.tf b/cloud/gcp/lb/inputs.tf index 1bf467a..072d32f 100644 --- a/cloud/gcp/lb/inputs.tf +++ b/cloud/gcp/lb/inputs.tf @@ -3,7 +3,7 @@ # variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags" { @@ -35,49 +35,49 @@ variable "prefix_slug" { # variable "error_rate_4xx_message" { description = "Custom message for the GCP LB 4XX Errors monitor" - type = "string" + type = string default = "" } variable "error_rate_4xx_time_aggregator" { description = "Timeframe for the GCP LB 4XX Errors monitor" - type = "string" + type = string default = "min" } variable "error_rate_4xx_timeframe" { description = "Timeframe for the GCP LB 4XX Errors monitor" - type = "string" + type = string default = "last_5m" } variable "error_rate_4xx_artificial_request" { description = "Divisor Delta for the GCP LB 4XX Errors monitor" - type = "string" + type = string default = 5 } variable "error_rate_4xx_threshold_warning" { description = "Rate error in percentage (warning threshold)" - type = "string" + type = string default = 50 } variable "error_rate_4xx_threshold_critical" { description = "Rate error in percentage (critical threshold)" - type = "string" + type = string default = 60 } variable "error_rate_4xx_enabled" { description = "Flag to enable GCP LB 4XX Errors monitor" - type = "string" + type = string default = "true" } variable "error_rate_4xx_extra_tags" { description = "Extra tags for GCP LB 4XX Errors monitor" - type = "list" + type = list(string) default = [] } @@ -86,49 +86,49 @@ variable "error_rate_4xx_extra_tags" { # variable "error_rate_5xx_message" { description = "Custom message for the GCP LB 5XX Errors monitor" - type = "string" + type = string default = "" } variable "error_rate_5xx_time_aggregator" { description = "Timeframe for the GCP LB 5XX Errors monitor" - type = "string" + type = string default = "min" } variable "error_rate_5xx_timeframe" { description = "Timeframe for the GCP LB 5XX Errors monitor" - type = "string" + type = string default = "last_5m" } variable "error_rate_5xx_artificial_request" { description = "Divisor Delta for the GCP LB 5XX Errors monitor" - type = "string" + type = string default = 5 } variable "error_rate_5xx_threshold_warning" { description = "Rate error in percentage (warning threshold)" - type = "string" + type = string default = 30 } variable "error_rate_5xx_threshold_critical" { description = "Rate error in percentage (critical threshold)" - type = "string" + type = string default = 40 } variable "error_rate_5xx_enabled" { description = "Flag to enable GCP LB 5XX Errors monitor" - type = "string" + type = string default = "true" } variable "error_rate_5xx_extra_tags" { description = "Extra tags for GCP LB 5XX Errors monitor" - type = "list" + type = list(string) default = [] } @@ -137,43 +137,43 @@ variable "error_rate_5xx_extra_tags" { # variable "backend_latency_service_message" { description = "Custom message for the GCP LB Backend Latency monitor" - type = "string" + type = string default = "" } variable "backend_latency_service_time_aggregator" { description = "Timeframe for the GCP LB Backend Latency monitor" - type = "string" + type = string default = "min" } variable "backend_latency_service_timeframe" { description = "Timeframe for the GCP LB Backend Latency monitor" - type = "string" + type = string default = "last_10m" } variable "backend_latency_service_threshold_warning" { description = "Latency in milliseconds (warning threshold)" - type = "string" + type = string default = 1000 } variable "backend_latency_service_threshold_critical" { description = "Latency in milliseconds (critical threshold)" - type = "string" + type = string default = 1500 } variable "backend_latency_service_enabled" { description = "Flag to enable GCP LB Backend Latency monitor" - type = "string" + type = string default = "true" } variable "backend_latency_service_extra_tags" { description = "Extra tags for GCP LB Backend Latency monitor" - type = "list" + type = list(string) default = [] } @@ -182,43 +182,43 @@ variable "backend_latency_service_extra_tags" { # variable "backend_latency_bucket_message" { description = "Custom message for the GCP LB Backend Latency monitor" - type = "string" + type = string default = "" } variable "backend_latency_bucket_time_aggregator" { description = "Timeframe for the GCP LB Backend Latency monitor" - type = "string" + type = string default = "min" } variable "backend_latency_bucket_timeframe" { description = "Timeframe for the GCP LB Backend Latency monitor" - type = "string" + type = string default = "last_10m" } variable "backend_latency_bucket_threshold_warning" { description = "Latency in milliseconds (warning threshold)" - type = "string" + type = string default = 4000 } variable "backend_latency_bucket_threshold_critical" { description = "Latency in milliseconds (critical threshold)" - type = "string" + type = string default = 8000 } variable "backend_latency_bucket_enabled" { description = "Flag to enable GCP LB Backend Latency monitor" - type = "string" + type = string default = "true" } variable "backend_latency_bucket_extra_tags" { description = "Extra tags for GCP LB Backend Latency monitor" - type = "list" + type = list(string) default = [] } @@ -227,48 +227,49 @@ variable "backend_latency_bucket_extra_tags" { # variable "request_count_message" { description = "Custom message for the GCP LB Request Count monitor" - type = "string" + type = string default = "" } variable "request_count_time_aggregator" { description = "Timeframe for the GCP LB Request Count monitor" - type = "string" + type = string default = "sum" } variable "request_count_timeframe" { description = "Timeframe for the GCP LB Request Count monitor" - type = "string" + type = string default = "last_5m" } variable "request_count_timeshift" { description = "Timeshift for the GCP LB Request Count monitor" - type = "string" + type = string default = "last_5m" } variable "request_count_threshold_warning" { description = "Desviation in percentage (warning threshold)" - type = "string" + type = string default = 250 } variable "request_count_threshold_critical" { description = "Desviation in percentage (critical threshold)" - type = "string" + type = string default = 500 } variable "request_count_enabled" { description = "Flag to enable GCP LB Request Count monitor" - type = "string" + type = string default = "true" } variable "request_count_extra_tags" { description = "Extra tags for GCP LB Request Count monitor" - type = "list" + type = list(string) default = [] } + diff --git a/cloud/gcp/lb/monitors-lb.tf b/cloud/gcp/lb/monitors-lb.tf index f623464..e39757f 100644 --- a/cloud/gcp/lb/monitors-lb.tf +++ b/cloud/gcp/lb/monitors-lb.tf @@ -2,10 +2,9 @@ # 4XX Errors # resource "datadog_monitor" "error_rate_4xx" { - count = "${var.error_rate_4xx_enabled == "true" ? 1 : 0}" + count = var.error_rate_4xx_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.error_rate_4xx_message, var.message)}" - + message = coalesce(var.error_rate_4xx_message, var.message) type = "query alert" query = < ${var.error_rate_4xx_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.error_rate_4xx_threshold_warning}" - critical = "${var.error_rate_4xx_threshold_critical}" + thresholds = { + warning = var.error_rate_4xx_threshold_warning + critical = var.error_rate_4xx_threshold_critical } - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = false - notify_no_data = false - renotify_interval = 0 + notify_no_data = false + renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", "${var.error_rate_4xx_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.error_rate_4xx_extra_tags] } # # 5XX Errors # resource "datadog_monitor" "error_rate_5xx" { - count = "${var.error_rate_5xx_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.error_rate_5xx_message, var.message)}" - + count = var.error_rate_5xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.error_rate_5xx_message, var.message) type = "query alert" query = < ${var.error_rate_5xx_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.error_rate_5xx_threshold_warning}" - critical = "${var.error_rate_5xx_threshold_critical}" - } +thresholds = { +warning = var.error_rate_5xx_threshold_warning +critical = var.error_rate_5xx_threshold_critical +} - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = false - renotify_interval = 0 +notify_audit = false +locked = false +timeout_h = 0 +include_tags = true +require_full_window = false +notify_no_data = false +renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", "${var.error_rate_5xx_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.error_rate_5xx_extra_tags] } # # Backend Latency for service # resource "datadog_monitor" "backend_latency_service" { - count = "${var.backend_latency_service_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB service backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" - message = "${coalesce(var.backend_latency_service_message, var.message)}" - +count = var.backend_latency_service_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB service backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" +message = coalesce(var.backend_latency_service_message, var.message) type = "query alert" - query = < ${var.backend_latency_service_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.backend_latency_service_threshold_warning}" - critical = "${var.backend_latency_service_threshold_critical}" - } +thresholds = { +warning = var.backend_latency_service_threshold_warning +critical = var.backend_latency_service_threshold_critical +} - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = false - renotify_interval = 0 +notify_audit = false +locked = false +timeout_h = 0 +include_tags = true +require_full_window = false +notify_no_data = false +renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", "${var.backend_latency_service_extra_tags}"] +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.backend_latency_service_extra_tags] } # # Backend Latency for bucket # resource "datadog_monitor" "backend_latency_bucket" { - count = "${var.backend_latency_bucket_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB bucket backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" - message = "${coalesce(var.backend_latency_bucket_message, var.message)}" - +count = var.backend_latency_bucket_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB bucket backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" +message = coalesce(var.backend_latency_bucket_message, var.message) type = "query alert" - query = < ${var.backend_latency_bucket_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.backend_latency_bucket_threshold_warning}" - critical = "${var.backend_latency_bucket_threshold_critical}" + thresholds = { + warning = var.backend_latency_bucket_threshold_warning + critical = var.backend_latency_bucket_threshold_critical } notify_audit = false @@ -134,43 +130,43 @@ resource "datadog_monitor" "backend_latency_bucket" { notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", "${var.backend_latency_bucket_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.backend_latency_bucket_extra_tags] } # # Request Count # resource "datadog_monitor" "request_count" { - count = "${var.request_count_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB Requests count increased abruptly {{#is_alert}}{{value}}%{{/is_alert}}{{#is_warning}}{{value}}%{{/is_warning}}" - message = "${coalesce(var.request_count_message, var.message)}" - + count = var.request_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB Requests count increased abruptly {{#is_alert}}{{value}}%%{{/is_alert}}{{#is_warning}}{{value}}%%{{/is_warning}}" + message = coalesce(var.request_count_message, var.message) type = "query alert" query = < ${var.request_count_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.request_count_threshold_warning}" - critical = "${var.request_count_threshold_critical}" + thresholds = { + warning = var.request_count_threshold_warning + critical = var.request_count_threshold_critical } - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = false - notify_no_data = false - renotify_interval = 0 + notify_no_data = false + renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", "${var.request_count_extra_tags}"] + tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.request_count_extra_tags] } + diff --git a/cloud/gcp/lb/outputs.tf b/cloud/gcp/lb/outputs.tf index 4718769..7e1eb55 100644 --- a/cloud/gcp/lb/outputs.tf +++ b/cloud/gcp/lb/outputs.tf @@ -1,24 +1,25 @@ output "error_rate_4xx_id" { description = "id for monitor error_rate_4xx" - value = "${datadog_monitor.error_rate_4xx.*.id}" + value = datadog_monitor.error_rate_4xx.*.id } output "error_rate_5xx_id" { description = "id for monitor error_rate_5xx" - value = "${datadog_monitor.error_rate_5xx.*.id}" + value = datadog_monitor.error_rate_5xx.*.id } output "backend_latency_service_id" { description = "id for monitor backend_latency_service" - value = "${datadog_monitor.backend_latency_service.*.id}" + value = datadog_monitor.backend_latency_service.*.id } output "backend_latency_bucket_id" { description = "id for monitor backend_latency_bucket" - value = "${datadog_monitor.backend_latency_bucket.*.id}" + value = datadog_monitor.backend_latency_bucket.*.id } output "request_count_id" { description = "id for monitor request_count" - value = "${datadog_monitor.request_count.*.id}" + value = datadog_monitor.request_count.*.id } + diff --git a/cloud/gcp/lb/versions.tf b/cloud/gcp/lb/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/gcp/lb/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/cloud/gcp/pubsub/inputs.tf b/cloud/gcp/pubsub/inputs.tf index 36325a1..8c55a19 100644 --- a/cloud/gcp/pubsub/inputs.tf +++ b/cloud/gcp/pubsub/inputs.tf @@ -3,7 +3,7 @@ # variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags" { @@ -35,37 +35,37 @@ variable "prefix_slug" { # variable "sending_operations_count_message" { description = "Custom message for the GCP Pub/Sub Sending Operations Count monitor" - type = "string" + type = string default = "" } variable "sending_operations_count_time_aggregator" { description = "Timeframe for the GCP Pub/Sub Sending Operations Count monitor" - type = "string" + type = string default = "sum" } variable "sending_operations_count_timeframe" { description = "Timeframe for the GCP Pub/Sub Sending Operations Count monitor" - type = "string" + type = string default = "last_30m" } variable "sending_operations_count_threshold_critical" { description = "Critical threshold for the number of sending operations." - type = "string" + type = string default = 0 } variable "sending_operations_count_enabled" { description = "Flag to enable GCP Pub/Sub Unavailable Sending Operations Count monitor" - type = "string" + type = string default = "true" } variable "sending_operations_count_extra_tags" { description = "Extra tags for GCP Pub/Sub Sending Operations Count monitor" - type = "list" + type = list(string) default = [] } @@ -74,42 +74,43 @@ variable "sending_operations_count_extra_tags" { # variable "unavailable_sending_operations_count_message" { description = "Custom message for the GCP Pub/Sub Unavailable Sending Operations Count monitor" - type = "string" + type = string default = "" } variable "unavailable_sending_operations_count_time_aggregator" { description = "Timeframe for the GCP Pub/Sub Unavailable Sending Operations Count monitor" - type = "string" + type = string default = "sum" } variable "unavailable_sending_operations_count_timeframe" { description = "Timeframe for the GCP Pub/Sub Unavailable Sending Operations Count monitor" - type = "string" + type = string default = "last_10m" } variable "unavailable_sending_operations_count_threshold_warning" { description = "Warning threshold for the number of unavailable sending operations" - type = "string" + type = string default = 2 } variable "unavailable_sending_operations_count_threshold_critical" { description = "Critical threshold for the number of unavailable sending operations" - type = "string" + type = string default = 4 } variable "unavailable_sending_operations_count_enabled" { description = "Flag to enable GCP Pub/Sub Unavailable Sending Operations Count monitor" - type = "string" + type = string default = "true" } variable "unavailable_sending_operations_count_extra_tags" { description = "Extra tags for GCP Pub/Sub Unavailable Sending Operations Count monitor" - type = "list" + type = list(string) default = [] } + diff --git a/cloud/gcp/pubsub/monitors-pubsub.tf b/cloud/gcp/pubsub/monitors-pubsub.tf index 2826eae..f40f79e 100644 --- a/cloud/gcp/pubsub/monitors-pubsub.tf +++ b/cloud/gcp/pubsub/monitors-pubsub.tf @@ -2,67 +2,66 @@ # Sending Operations Count # resource "datadog_monitor" "sending_operations_count" { - count = "${var.sending_operations_count_enabled == "true" ? 1 : 0}" + count = var.sending_operations_count_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP pubsub sending messages operations {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.sending_operations_count_message, var.message)}" - + message = coalesce(var.sending_operations_count_message, var.message) type = "query alert" query = <= ${var.unavailable_sending_operations_count_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.unavailable_sending_operations_count_threshold_warning}" - critical = "${var.unavailable_sending_operations_count_threshold_critical}" - } - - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = false - renotify_interval = 0 - - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform", "${var.unavailable_sending_operations_count_extra_tags}"] +thresholds = { +warning = var.unavailable_sending_operations_count_threshold_warning +critical = var.unavailable_sending_operations_count_threshold_critical } + +notify_audit = false +locked = false +timeout_h = 0 +include_tags = true +require_full_window = false +notify_no_data = false +renotify_interval = 0 + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay + +tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform", var.unavailable_sending_operations_count_extra_tags] +} + diff --git a/cloud/gcp/pubsub/outputs.tf b/cloud/gcp/pubsub/outputs.tf index 869f4b8..a08edb8 100644 --- a/cloud/gcp/pubsub/outputs.tf +++ b/cloud/gcp/pubsub/outputs.tf @@ -1,9 +1,10 @@ output "sending_operations_count_id" { description = "id for monitor sending_operations_count" - value = "${datadog_monitor.sending_operations_count.*.id}" + value = datadog_monitor.sending_operations_count.*.id } output "unavailable_sending_operations_count_id" { description = "id for monitor unavailable_sending_operations_count" - value = "${datadog_monitor.unavailable_sending_operations_count.*.id}" + value = datadog_monitor.unavailable_sending_operations_count.*.id } + diff --git a/cloud/gcp/pubsub/versions.tf b/cloud/gcp/pubsub/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/cloud/gcp/pubsub/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/common/alerting-message/inputs.tf b/common/alerting-message/inputs.tf index 7a0e3ec..3ebe0cf 100644 --- a/common/alerting-message/inputs.tf +++ b/common/alerting-message/inputs.tf @@ -1,27 +1,28 @@ variable "message_alert" { description = "Define a broadcast channel for critical alerts" - type = "string" + type = string } variable "message_warning" { description = "Define a broadcast channel for warning alerts" - type = "string" + type = string } variable "message_nodata" { description = "Define a broadcast channel for nodata alerts" - type = "string" + type = string default = "" } variable "prepend_text" { description = "Optional free text string to prepend to alert" - type = "string" + type = string default = "" } variable "append_text" { description = "Optional free text string to append to alert" - type = "string" + type = string default = "" } + diff --git a/common/alerting-message/main.tf b/common/alerting-message/main.tf index 81b3369..1f81058 100644 --- a/common/alerting-message/main.tf +++ b/common/alerting-message/main.tf @@ -10,11 +10,13 @@ $${prepend_text} $${append_text} EOF - vars { - message_alert = "${var.message_alert}" - message_warning = "${var.message_warning}" - message_nodata = "${coalesce(var.message_nodata,var.message_alert)}" - prepend_text = "${var.prepend_text}" - append_text = "${var.append_text}" + + vars = { + message_alert = var.message_alert + message_warning = var.message_warning + message_nodata = coalesce(var.message_nodata, var.message_alert) + prepend_text = var.prepend_text + append_text = var.append_text } } + diff --git a/common/alerting-message/outputs.tf b/common/alerting-message/outputs.tf index 8a9d93e..56bdca8 100644 --- a/common/alerting-message/outputs.tf +++ b/common/alerting-message/outputs.tf @@ -1,4 +1,5 @@ output "alerting-message" { description = "The generated message string" - value = "${data.template_file.alerting-message.rendered}" + value = data.template_file.alerting-message.rendered } + diff --git a/common/alerting-message/versions.tf b/common/alerting-message/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/common/alerting-message/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/common/filter-tags/inputs.tf b/common/filter-tags/inputs.tf index c4b8283..be03838 100644 --- a/common/filter-tags/inputs.tf +++ b/common/filter-tags/inputs.tf @@ -1,11 +1,11 @@ variable "environment" { description = "Architecture Environment" - type = "string" + type = string } variable "resource" { description = "The dedicated tag for the resource" - type = "string" + type = string } variable "filter_tags_use_defaults" { @@ -25,12 +25,13 @@ variable "filter_tags_custom_excluded" { variable "extra_tags" { description = "Extra optional tags added to include filtering in any case (i.e. [\"tag1:val1\", \"tag2:val2\"])" - type = "list" + type = list(string) default = [] } variable "extra_tags_excluded" { description = "Extra optional tags added to exclude filtering in any case (i.e. [\"tag1:val1\", \"tag2:val2\"])" - type = "list" + type = list(string) default = [] } + diff --git a/common/filter-tags/locals.tf b/common/filter-tags/locals.tf index 1a3d95e..12a4dd7 100644 --- a/common/filter-tags/locals.tf +++ b/common/filter-tags/locals.tf @@ -1,8 +1,34 @@ locals { - including_default_list = "${compact(concat(split(",", format("dd_monitoring:enabled,dd_%s:enabled,env:%s", var.resource, var.environment)), compact(var.extra_tags)))}" - including_custom_list = "${compact(concat(split(",", var.filter_tags_custom), compact(var.extra_tags)))}" - excluding_list = "${compact(split(",", var.filter_tags_use_defaults == "true" ? join(",", compact(var.extra_tags_excluded)) : join(",", concat(split(",", var.filter_tags_custom_excluded), compact(var.extra_tags_excluded)))))}" + including_default_list = compact( + concat( + split( + ",", + format( + "dd_monitoring:enabled,dd_%s:enabled,env:%s", + var.resource, + var.environment, + ), + ), + compact(var.extra_tags), + ), + ) + including_custom_list = compact( + concat(split(",", var.filter_tags_custom), compact(var.extra_tags)), + ) + excluding_list = compact( + split( + ",", + var.filter_tags_use_defaults == "true" ? join(",", compact(var.extra_tags_excluded)) : join( + ",", + concat( + split(",", var.filter_tags_custom_excluded), + compact(var.extra_tags_excluded), + ), + ), + ), + ) - including_string = "${var.filter_tags_use_defaults == "true" ? join(",", local.including_default_list) : join(",", local.including_custom_list)}" - excluding_string = "${join(",", local.excluding_list)}" + including_string = var.filter_tags_use_defaults == "true" ? join(",", local.including_default_list) : join(",", local.including_custom_list) + excluding_string = join(",", local.excluding_list) } + diff --git a/common/filter-tags/outputs.tf b/common/filter-tags/outputs.tf index c70bbdc..3d9f6c7 100644 --- a/common/filter-tags/outputs.tf +++ b/common/filter-tags/outputs.tf @@ -4,7 +4,15 @@ # query_alert = {tag:val,tag2:val2,!excludedtag:value,!exludedtag2:value2} output "query_alert" { description = "The full filtering pattern including parentheses for service check monitor type" - value = "{${join(",", compact(concat(list(local.including_string), formatlist("!%s", local.excluding_list))))}}" + value = "{${join( + ",", + compact( + concat( + [local.including_string], + formatlist("!%s", local.excluding_list), + ), + ), + )}}" } # service_check = .over("tag:val","tag2:val2").exclude("excludedtag:value","exludedtag2:value2") @@ -18,3 +26,4 @@ output "event_alert" { description = "The full filtering pattern for event alert monitor type" value = "tags:${local.including_string}${local.excluding_string == "" ? "" : " excluded_tags:${local.excluding_string}"}" } + diff --git a/common/filter-tags/versions.tf b/common/filter-tags/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/common/filter-tags/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/database/elasticsearch/inputs.tf b/database/elasticsearch/inputs.tf index d31085a..158684b 100644 --- a/database/elasticsearch/inputs.tf +++ b/database/elasticsearch/inputs.tf @@ -3,7 +3,7 @@ # variable "environment" { description = "Architecture environment" - type = "string" + type = string } variable "filter_tags_use_defaults" { @@ -45,43 +45,43 @@ variable "prefix_slug" { # variable "cluster_status_not_green_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "cluster_status_not_green_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "cluster_status_not_green_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_5m" } variable "cluster_status_not_green_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 1 } variable "cluster_status_not_green_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 0 } variable "cluster_status_not_green_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "cluster_status_not_green_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -90,43 +90,43 @@ variable "cluster_status_not_green_extra_tags" { # variable "cluster_initializing_shards_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "cluster_initializing_shards_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "cluster_initializing_shards_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_5m" } variable "cluster_initializing_shards_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 1 } variable "cluster_initializing_shards_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 2 } variable "cluster_initializing_shards_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "cluster_initializing_shards_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -135,43 +135,43 @@ variable "cluster_initializing_shards_extra_tags" { # variable "cluster_relocating_shards_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "cluster_relocating_shards_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "cluster_relocating_shards_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_5m" } variable "cluster_relocating_shards_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 1 } variable "cluster_relocating_shards_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 2 } variable "cluster_relocating_shards_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "cluster_relocating_shards_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -180,43 +180,43 @@ variable "cluster_relocating_shards_extra_tags" { # variable "cluster_unassigned_shards_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "cluster_unassigned_shards_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "cluster_unassigned_shards_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_5m" } variable "cluster_unassigned_shards_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 1 } variable "cluster_unassigned_shards_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 2 } variable "cluster_unassigned_shards_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "cluster_unassigned_shards_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -225,43 +225,43 @@ variable "cluster_unassigned_shards_extra_tags" { # variable "node_free_space_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "node_free_space_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "sum" } variable "node_free_space_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_5m" } variable "node_free_space_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 20 } variable "node_free_space_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 10 } variable "node_free_space_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "node_free_space_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -270,43 +270,43 @@ variable "node_free_space_extra_tags" { # variable "jvm_heap_memory_usage_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "jvm_heap_memory_usage_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "jvm_heap_memory_usage_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_5m" } variable "jvm_heap_memory_usage_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 80 } variable "jvm_heap_memory_usage_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 90 } variable "jvm_heap_memory_usage_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "jvm_heap_memory_usage_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -315,43 +315,43 @@ variable "jvm_heap_memory_usage_extra_tags" { # variable "jvm_memory_young_usage_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "jvm_memory_young_usage_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "jvm_memory_young_usage_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "jvm_memory_young_usage_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 80 } variable "jvm_memory_young_usage_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 90 } variable "jvm_memory_young_usage_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "jvm_memory_young_usage_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -360,43 +360,43 @@ variable "jvm_memory_young_usage_extra_tags" { # variable "jvm_memory_old_usage_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "jvm_memory_old_usage_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "jvm_memory_old_usage_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "jvm_memory_old_usage_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 80 } variable "jvm_memory_old_usage_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 90 } variable "jvm_memory_old_usage_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "jvm_memory_old_usage_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -405,43 +405,43 @@ variable "jvm_memory_old_usage_extra_tags" { # variable "jvm_gc_old_collection_latency_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "jvm_gc_old_collection_latency_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "jvm_gc_old_collection_latency_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "jvm_gc_old_collection_latency_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 160 } variable "jvm_gc_old_collection_latency_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 200 } variable "jvm_gc_old_collection_latency_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "jvm_gc_old_collection_latency_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -450,43 +450,43 @@ variable "jvm_gc_old_collection_latency_extra_tags" { # variable "jvm_gc_young_collection_latency_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "jvm_gc_young_collection_latency_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "jvm_gc_young_collection_latency_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "jvm_gc_young_collection_latency_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 20 } variable "jvm_gc_young_collection_latency_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 25 } variable "jvm_gc_young_collection_latency_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "jvm_gc_young_collection_latency_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -495,43 +495,43 @@ variable "jvm_gc_young_collection_latency_extra_tags" { # variable "indexing_latency_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "indexing_latency_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "indexing_latency_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "indexing_latency_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 10 } variable "indexing_latency_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 15 } variable "indexing_latency_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "indexing_latency_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -540,43 +540,43 @@ variable "indexing_latency_extra_tags" { # variable "flush_latency_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "flush_latency_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "flush_latency_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "flush_latency_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 50 } variable "flush_latency_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 100 } variable "flush_latency_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "flush_latency_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -585,85 +585,85 @@ variable "flush_latency_extra_tags" { # variable "http_connections_anomaly_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "http_connections_anomaly_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "http_connections_anomaly_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_4h" } variable "http_connections_anomaly_detection_algorithm" { description = "Anomaly Detection Algorithm used" - type = "string" + type = string default = "agile" } variable "http_connections_anomaly_deviations" { description = "Deviations to detect the anomaly" - type = "string" + type = string default = 2 } variable "http_connections_anomaly_direction" { description = "Direction of the anomaly. It can be both, below or above." - type = "string" + type = string default = "above" } variable "http_connections_anomaly_alert_window" { description = "Alert window." - type = "string" + type = string default = "last_15m" } variable "http_connections_anomaly_interval" { description = "Interval." - type = "string" + type = string default = 60 } variable "http_connections_anomaly_count_default_zero" { description = "Count default zero." - type = "string" + type = string default = "true" } variable "http_connections_anomaly_seasonality" { description = "Seasonality of the algorithm" - type = "string" + type = string default = "hourly" } variable "http_connections_anomaly_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 0.75 } variable "http_connections_anomaly_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 1 } variable "http_connections_anomaly_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "http_connections_anomaly_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -672,43 +672,43 @@ variable "http_connections_anomaly_extra_tags" { # variable "search_query_latency_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "search_query_latency_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "search_query_latency_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "search_query_latency_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 0.5 } variable "search_query_latency_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 1 } variable "search_query_latency_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "search_query_latency_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -717,43 +717,43 @@ variable "search_query_latency_extra_tags" { # variable "fetch_latency_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "fetch_latency_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "fetch_latency_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "fetch_latency_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 2 } variable "fetch_latency_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 4 } variable "fetch_latency_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "fetch_latency_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -762,49 +762,49 @@ variable "fetch_latency_extra_tags" { # variable "search_query_change_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "search_query_change_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "search_query_change_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "search_query_change_timeshift" { description = "Timeshift for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "search_query_change_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 75 } variable "search_query_change_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 100 } variable "search_query_change_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "search_query_change_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -813,49 +813,49 @@ variable "search_query_change_extra_tags" { # variable "fetch_change_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "fetch_change_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "fetch_change_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "fetch_change_timeshift" { description = "Timeshift for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "fetch_change_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 75 } variable "fetch_change_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 100 } variable "fetch_change_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "fetch_change_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -864,49 +864,49 @@ variable "fetch_change_extra_tags" { # variable "field_data_evictions_change_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "field_data_evictions_change_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "field_data_evictions_change_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_15m" } variable "field_data_evictions_change_timeshift" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_15m" } variable "field_data_evictions_change_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 60 } variable "field_data_evictions_change_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 120 } variable "field_data_evictions_change_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "field_data_evictions_change_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -915,49 +915,49 @@ variable "field_data_evictions_change_extra_tags" { # variable "query_cache_evictions_change_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "query_cache_evictions_change_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "query_cache_evictions_change_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_15m" } variable "query_cache_evictions_change_timeshift" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_15m" } variable "query_cache_evictions_change_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 60 } variable "query_cache_evictions_change_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 120 } variable "query_cache_evictions_change_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "query_cache_evictions_change_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -966,49 +966,49 @@ variable "query_cache_evictions_change_extra_tags" { # variable "request_cache_evictions_change_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "request_cache_evictions_change_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "request_cache_evictions_change_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_15m" } variable "request_cache_evictions_change_timeshift" { description = "Timeshift for the Cluster Status monitor" - type = "string" + type = string default = "last_15m" } variable "request_cache_evictions_change_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 60 } variable "request_cache_evictions_change_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 120 } variable "request_cache_evictions_change_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "request_cache_evictions_change_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -1017,49 +1017,49 @@ variable "request_cache_evictions_change_extra_tags" { # variable "task_time_in_queue_change_message" { description = "Custom message for the Cluster Status monitor" - type = "string" + type = string default = "" } variable "task_time_in_queue_change_time_aggregator" { description = "Time aggregator for the Cluster Status monitor" - type = "string" + type = string default = "avg" } variable "task_time_in_queue_change_timeframe" { description = "Timeframe for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "task_time_in_queue_change_timeshift" { description = "Timeshift for the Cluster Status monitor" - type = "string" + type = string default = "last_10m" } variable "task_time_in_queue_change_threshold_warning" { description = "Cluster Status warning threshold" - type = "string" + type = string default = 100 } variable "task_time_in_queue_change_threshold_critical" { description = "Cluster Status critical threshold" - type = "string" + type = string default = 200 } variable "task_time_in_queue_change_enabled" { description = "Flag to enable Cluster Status monitor" - type = "string" + type = string default = "true" } variable "task_time_in_queue_change_extra_tags" { description = "Extra tags for Cluster Status monitor" - type = "list" + type = list(string) default = [] } @@ -1069,13 +1069,13 @@ variable "task_time_in_queue_change_extra_tags" { variable "not_responding_enabled" { description = "Flag to enable Elasticsearch does not respond monitor" - type = "string" + type = string default = "true" } variable "not_responding_message" { description = "Custom message for Elasticsearch does not respond monitor" - type = "string" + type = string default = "" } @@ -1086,12 +1086,13 @@ variable "not_responding_threshold_warning" { variable "not_responding_no_data_timeframe" { description = "Elasticsearch not responding monitor no data timeframe" - type = "string" + type = string default = 10 } variable "not_responding_extra_tags" { description = "Extra tags for Elasticsearch does not respond monitor" - type = "list" + type = list(string) default = [] } + diff --git a/database/elasticsearch/modules.tf b/database/elasticsearch/modules.tf index 49a9551..6f3dc60 100644 --- a/database/elasticsearch/modules.tf +++ b/database/elasticsearch/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "elasticsearch" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/database/elasticsearch/monitors-elasticsearch.tf b/database/elasticsearch/monitors-elasticsearch.tf index af0328e..369183f 100644 --- a/database/elasticsearch/monitors-elasticsearch.tf +++ b/database/elasticsearch/monitors-elasticsearch.tf @@ -2,211 +2,166 @@ # Service Check # resource "datadog_monitor" "not_responding" { - count = "${var.not_responding_enabled == "true" ? 1 : 0}" + count = var.not_responding_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch does not respond" - message = "${coalesce(var.not_responding_message, var.message)}" + message = coalesce(var.not_responding_message, var.message) + type = "service check" query = < ${var.cluster_initializing_shards_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.cluster_initializing_shards_threshold_warning}" - critical = "${var.cluster_initializing_shards_threshold_critical}" - } +thresholds = { +warning = var.cluster_initializing_shards_threshold_warning +critical = var.cluster_initializing_shards_threshold_critical +} - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.cluster_initializing_shards_extra_tags}", - ] +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.cluster_initializing_shards_extra_tags] } # # Cluster Relocating Shards # resource "datadog_monitor" "cluster_relocating_shards" { - count = "${var.cluster_relocating_shards_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster is relocating shards" - message = "${coalesce(var.cluster_relocating_shards_message, var.message)}" +count = var.cluster_relocating_shards_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster is relocating shards" +message = coalesce(var.cluster_relocating_shards_message, var.message) +type = "metric alert" - type = "metric alert" - - query = < ${var.cluster_relocating_shards_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.cluster_relocating_shards_threshold_warning}" - critical = "${var.cluster_relocating_shards_threshold_critical}" + thresholds = { + warning = var.cluster_relocating_shards_threshold_warning + critical = var.cluster_relocating_shards_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_audit = false locked = false include_tags = true require_full_window = true notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.cluster_relocating_shards_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.cluster_relocating_shards_extra_tags] } # # Cluster Unassigned Shards # resource "datadog_monitor" "cluster_unassigned_shards" { - count = "${var.cluster_unassigned_shards_enabled == "true" ? 1 : 0}" + count = var.cluster_unassigned_shards_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster has unassigned shards" - message = "${coalesce(var.cluster_unassigned_shards_message, var.message)}" - + message = coalesce(var.cluster_unassigned_shards_message, var.message) type = "metric alert" query = < ${var.cluster_unassigned_shards_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.cluster_unassigned_shards_threshold_warning}" - critical = "${var.cluster_unassigned_shards_threshold_critical}" + thresholds = { + warning = var.cluster_unassigned_shards_threshold_warning + critical = var.cluster_unassigned_shards_threshold_critical } - notify_audit = false - locked = false - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true require_full_window = true - notify_no_data = false + notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.cluster_unassigned_shards_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.cluster_unassigned_shards_extra_tags] } # # Free Space in nodes # resource "datadog_monitor" "node_free_space" { - count = "${var.node_free_space_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch free space < 10%" - message = "${coalesce(var.node_free_space_message, var.message)}" + count = var.node_free_space_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch free space < 10%" + message = coalesce(var.node_free_space_message, var.message) type = "query alert" @@ -217,281 +172,218 @@ resource "datadog_monitor" "node_free_space" { min:elasticsearch.fs.total.total_in_bytes${module.filter-tags.query_alert} by {node_name} ) * 100 < ${var.node_free_space_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.node_free_space_threshold_warning}" - critical = "${var.node_free_space_threshold_critical}" - } +thresholds = { +warning = var.node_free_space_threshold_warning +critical = var.node_free_space_threshold_critical +} - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.node_free_space_extra_tags}", - ] +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.node_free_space_extra_tags] } # # JVM Heap Memory Usage # resource "datadog_monitor" "jvm_heap_memory_usage" { - count = "${var.jvm_heap_memory_usage_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch JVM HEAP memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.jvm_heap_memory_usage_message, var.message)}" +count = var.jvm_heap_memory_usage_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch JVM HEAP memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.jvm_heap_memory_usage_message, var.message) +type = "query alert" - type = "query alert" - - query = < ${var.jvm_heap_memory_usage_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.jvm_heap_memory_usage_threshold_warning}" - critical = "${var.jvm_heap_memory_usage_threshold_critical}" - } +thresholds = { +warning = var.jvm_heap_memory_usage_threshold_warning +critical = var.jvm_heap_memory_usage_threshold_critical +} - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.jvm_heap_memory_usage_extra_tags}", - ] +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_heap_memory_usage_extra_tags] } # # JVM Memory Young Usage # resource "datadog_monitor" "jvm_memory_young_usage" { - count = "${var.jvm_memory_young_usage_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch JVM memory Young usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.jvm_memory_young_usage_message, var.message)}" +count = var.jvm_memory_young_usage_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch JVM memory Young usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.jvm_memory_young_usage_message, var.message) +type = "query alert" - type = "query alert" - - query = < ${var.jvm_memory_young_usage_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.jvm_memory_young_usage_threshold_warning}" - critical = "${var.jvm_memory_young_usage_threshold_critical}" + thresholds = { + warning = var.jvm_memory_young_usage_threshold_warning + critical = var.jvm_memory_young_usage_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_audit = false locked = false include_tags = true require_full_window = true notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.jvm_memory_young_usage_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_memory_young_usage_extra_tags] } # # JVM Memory Old Usage # resource "datadog_monitor" "jvm_memory_old_usage" { - count = "${var.jvm_memory_old_usage_enabled == "true" ? 1 : 0}" + count = var.jvm_memory_old_usage_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch JVM memory Old usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.jvm_memory_old_usage_message, var.message)}" - + message = coalesce(var.jvm_memory_old_usage_message, var.message) type = "query alert" query = < ${var.jvm_memory_old_usage_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.jvm_memory_old_usage_threshold_warning}" - critical = "${var.jvm_memory_old_usage_threshold_critical}" + thresholds = { + warning = var.jvm_memory_old_usage_threshold_warning + critical = var.jvm_memory_old_usage_threshold_critical } - notify_audit = false - locked = false - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true require_full_window = true - notify_no_data = false + notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.jvm_memory_old_usage_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_memory_old_usage_extra_tags] } # # JVM Garbace Collector Old Collection Latency # resource "datadog_monitor" "jvm_gc_old_collection_latency" { - count = "${var.jvm_gc_old_collection_latency_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average Old-generation garbage collections latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" - message = "${coalesce(var.jvm_gc_old_collection_latency_message, var.message)}" - + count = var.jvm_gc_old_collection_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average Old-generation garbage collections latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.jvm_gc_old_collection_latency_message, var.message) type = "query alert" query = < ${var.jvm_gc_old_collection_latency_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.jvm_gc_old_collection_latency_threshold_warning}" - critical = "${var.jvm_gc_old_collection_latency_threshold_critical}" - } +thresholds = { +warning = var.jvm_gc_old_collection_latency_threshold_warning +critical = var.jvm_gc_old_collection_latency_threshold_critical +} - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.jvm_gc_old_collection_latency_extra_tags}", - ] +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_gc_old_collection_latency_extra_tags] } # # JVM Garbace Collector Young Collection Latency # resource "datadog_monitor" "jvm_gc_young_collection_latency" { - count = "${var.jvm_gc_young_collection_latency_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average Young-generation garbage collections latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" - message = "${coalesce(var.jvm_gc_young_collection_latency_message, var.message)}" +count = var.jvm_gc_young_collection_latency_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average Young-generation garbage collections latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" +message = coalesce(var.jvm_gc_young_collection_latency_message, var.message) +type = "query alert" - type = "query alert" - - query = < ${var.jvm_gc_young_collection_latency_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.jvm_gc_young_collection_latency_threshold_warning}" - critical = "${var.jvm_gc_young_collection_latency_threshold_critical}" - } +thresholds = { +warning = var.jvm_gc_young_collection_latency_threshold_warning +critical = var.jvm_gc_young_collection_latency_threshold_critical +} - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.jvm_gc_young_collection_latency_extra_tags}", - ] +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_gc_young_collection_latency_extra_tags] } # # Indexing Latency # resource "datadog_monitor" "indexing_latency" { - count = "${var.indexing_latency_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average indexing time by document {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" - message = "${coalesce(var.indexing_latency_message, var.message)}" +count = var.indexing_latency_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average indexing time by document {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" +message = coalesce(var.indexing_latency_message, var.message) +type = "query alert" - type = "query alert" - - // TODO add tags to filter by node type and do not apply this monitor on non-data nodes - query = < ${var.indexing_latency_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.indexing_latency_threshold_warning}" - critical = "${var.indexing_latency_threshold_critical}" + thresholds = { + warning = var.indexing_latency_threshold_warning + critical = var.indexing_latency_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_audit = false locked = false include_tags = true require_full_window = true notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.indexing_latency_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.indexing_latency_extra_tags] } # # Flush Latency # resource "datadog_monitor" "flush_latency" { - count = "${var.flush_latency_enabled == "true" ? 1 : 0}" + count = var.flush_latency_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average index flushing to disk latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" - message = "${coalesce(var.flush_latency_message, var.message)}" - + message = coalesce(var.flush_latency_message, var.message) type = "query alert" // TODO add tags to filter by node type and do not apply this monitor on non-data nodes @@ -499,40 +391,31 @@ resource "datadog_monitor" "flush_latency" { ${var.flush_latency_time_aggregator}(${var.flush_latency_timeframe}): avg:elasticsearch.flush.total.time${module.filter-tags.query_alert} by {node_name} / avg:elasticsearch.flush.total${module.filter-tags.query_alert} by {node_name} * 1000 > ${var.flush_latency_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.flush_latency_threshold_warning}" - critical = "${var.flush_latency_threshold_critical}" + thresholds = { + warning = var.flush_latency_threshold_warning + critical = var.flush_latency_threshold_critical } - notify_audit = false - locked = false - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true require_full_window = true - notify_no_data = false + notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.flush_latency_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.flush_latency_extra_tags] } # # Open HTTP Connections Anomaly # resource "datadog_monitor" "http_connections_anomaly" { - count = "${var.http_connections_anomaly_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch number of current open HTTP connections anomaly detected" - message = "${coalesce(var.http_connections_anomaly_message, var.message)}" - + count = var.http_connections_anomaly_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch number of current open HTTP connections anomaly detected" + message = coalesce(var.http_connections_anomaly_message, var.message) type = "query alert" query = <= ${var.http_connections_anomaly_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.http_connections_anomaly_threshold_warning}" - critical = "${var.http_connections_anomaly_threshold_critical}" - } +thresholds = { +warning = var.http_connections_anomaly_threshold_warning +critical = var.http_connections_anomaly_threshold_critical +} - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.http_connections_anomaly_extra_tags}", - ] +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.http_connections_anomaly_extra_tags] } # # Query Latency # resource "datadog_monitor" "search_query_latency" { - count = "${var.search_query_latency_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search query latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" - message = "${coalesce(var.search_query_latency_message, var.message)}" +count = var.search_query_latency_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search query latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" +message = coalesce(var.search_query_latency_message, var.message) +type = "query alert" - type = "query alert" - - // TODO add tags to filter by node type and do not apply this monitor on non-data nodes - query = < ${var.search_query_latency_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.search_query_latency_threshold_warning}" - critical = "${var.search_query_latency_threshold_critical}" - } +thresholds = { +warning = var.search_query_latency_threshold_warning +critical = var.search_query_latency_threshold_critical +} - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.search_query_latency_extra_tags}", - ] +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.search_query_latency_extra_tags] } # # Fetch Latency # resource "datadog_monitor" "fetch_latency" { - count = "${var.fetch_latency_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search fetch latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" - message = "${coalesce(var.fetch_latency_message, var.message)}" +count = var.fetch_latency_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search fetch latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" +message = coalesce(var.fetch_latency_message, var.message) +type = "query alert" - type = "query alert" - - // TODO add tags to filter by node type and do not apply this monitor on non-data nodes - query = < ${var.fetch_latency_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.fetch_latency_threshold_warning}" - critical = "${var.fetch_latency_threshold_critical}" + thresholds = { + warning = var.fetch_latency_threshold_warning + critical = var.fetch_latency_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_audit = false locked = false include_tags = true require_full_window = true notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.fetch_latency_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.fetch_latency_extra_tags] } # # Search Query Change # resource "datadog_monitor" "search_query_change" { - count = "${var.search_query_change_enabled == "true" ? 1 : 0}" + count = var.search_query_change_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of currently active queries" - message = "${coalesce(var.search_query_change_message, var.message)}" - + message = coalesce(var.search_query_change_message, var.message) type = "query alert" query = <= ${var.search_query_change_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.search_query_change_threshold_warning}" - critical = "${var.search_query_change_threshold_critical}" + thresholds = { + warning = var.search_query_change_threshold_warning + critical = var.search_query_change_threshold_critical } - notify_audit = false - locked = false - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true require_full_window = true - notify_no_data = false + notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.search_query_change_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.search_query_change_extra_tags] } # # Fetch Change # resource "datadog_monitor" "fetch_change" { - count = "${var.fetch_change_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of search fetches currently running" - message = "${coalesce(var.fetch_change_message, var.message)}" - + count = var.fetch_change_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of search fetches currently running" + message = coalesce(var.fetch_change_message, var.message) type = "query alert" query = <= ${var.fetch_change_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.fetch_change_threshold_warning}" - critical = "${var.fetch_change_threshold_critical}" - } +thresholds = { +warning = var.fetch_change_threshold_warning +critical = var.fetch_change_threshold_critical +} - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.fetch_change_extra_tags}", - ] +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.fetch_change_extra_tags] } # # Field Data Evictions # resource "datadog_monitor" "field_data_evictions_change" { - count = "${var.field_data_evictions_change_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the total number of evictions from the fielddata cache" - message = "${coalesce(var.field_data_evictions_change_message, var.message)}" +count = var.field_data_evictions_change_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the total number of evictions from the fielddata cache" +message = coalesce(var.field_data_evictions_change_message, var.message) +type = "query alert" - type = "query alert" - - // TODO add tags to filter by node type and do not apply this monitor on non-data nodes - query = < ${var.field_data_evictions_change_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.field_data_evictions_change_threshold_warning}" - critical = "${var.field_data_evictions_change_threshold_critical}" - } +thresholds = { +warning = var.field_data_evictions_change_threshold_warning +critical = var.field_data_evictions_change_threshold_critical +} - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.field_data_evictions_change_extra_tags}", - ] +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.field_data_evictions_change_extra_tags] } # # Query Cache Evictions # resource "datadog_monitor" "query_cache_evictions_change" { - count = "${var.query_cache_evictions_change_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of query cache evictions" - message = "${coalesce(var.query_cache_evictions_change_message, var.message)}" +count = var.query_cache_evictions_change_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of query cache evictions" +message = coalesce(var.query_cache_evictions_change_message, var.message) +type = "query alert" - type = "query alert" - - // TODO add tags to filter by node type and do not apply this monitor on non-data nodes - query = < ${var.query_cache_evictions_change_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.query_cache_evictions_change_threshold_warning}" - critical = "${var.query_cache_evictions_change_threshold_critical}" + thresholds = { + warning = var.query_cache_evictions_change_threshold_warning + critical = var.query_cache_evictions_change_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_audit = false locked = false include_tags = true require_full_window = true notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.query_cache_evictions_change_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.query_cache_evictions_change_extra_tags] } # # Request Cache Evictions # resource "datadog_monitor" "request_cache_evictions_change" { - count = "${var.request_cache_evictions_change_enabled == "true" ? 1 : 0}" + count = var.request_cache_evictions_change_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of request cache evictions" - message = "${coalesce(var.request_cache_evictions_change_message, var.message)}" - + message = coalesce(var.request_cache_evictions_change_message, var.message) type = "query alert" // TODO add tags to filter by node type and do not apply this monitor on non-data nodes @@ -832,68 +652,52 @@ resource "datadog_monitor" "request_cache_evictions_change" { change(${var.request_cache_evictions_change_time_aggregator}(${var.request_cache_evictions_change_timeframe}),${var.request_cache_evictions_change_timeshift}): avg:elasticsearch.indices.request_cache.evictions${module.filter-tags.query_alert} by {node_name} > ${var.request_cache_evictions_change_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.request_cache_evictions_change_threshold_warning}" - critical = "${var.request_cache_evictions_change_threshold_critical}" + thresholds = { + warning = var.request_cache_evictions_change_threshold_warning + critical = var.request_cache_evictions_change_threshold_critical } - notify_audit = false - locked = false - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true require_full_window = true - notify_no_data = false + notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.request_cache_evictions_change_extra_tags}", - ] + tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.request_cache_evictions_change_extra_tags] } # # Task Time in Queue # resource "datadog_monitor" "task_time_in_queue_change" { - count = "${var.task_time_in_queue_change_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the average time spent by tasks in the queue" - message = "${coalesce(var.task_time_in_queue_change_message, var.message)}" - + count = var.task_time_in_queue_change_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the average time spent by tasks in the queue" + message = coalesce(var.task_time_in_queue_change_message, var.message) type = "query alert" query = < ${var.task_time_in_queue_change_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.task_time_in_queue_change_threshold_warning}" - critical = "${var.task_time_in_queue_change_threshold_critical}" - } - - notify_audit = false - locked = false - include_tags = true - require_full_window = true - notify_no_data = false - - evaluation_delay = "${var.evaluation_delay}" - - tags = [ - "resource:elasticsearch", - "env:${var.environment}", - "created-by:terraform", - "team:claranet", - "type:database", - "provider:elasticsearch", - "${var.task_time_in_queue_change_extra_tags}", - ] +thresholds = { +warning = var.task_time_in_queue_change_threshold_warning +critical = var.task_time_in_queue_change_threshold_critical } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_audit = false +locked = false +include_tags = true +require_full_window = true +notify_no_data = false + +tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.task_time_in_queue_change_extra_tags] +} + diff --git a/database/elasticsearch/outputs.tf b/database/elasticsearch/outputs.tf index 9c90913..5a694bb 100644 --- a/database/elasticsearch/outputs.tf +++ b/database/elasticsearch/outputs.tf @@ -1,109 +1,110 @@ output "not_responding_id" { description = "id for monitor not_responding" - value = "${datadog_monitor.not_responding.*.id}" + value = datadog_monitor.not_responding.*.id } output "cluster_status_not_green_id" { description = "id for monitor cluster_status_not_green" - value = "${datadog_monitor.cluster_status_not_green.*.id}" + value = datadog_monitor.cluster_status_not_green.*.id } output "cluster_initializing_shards_id" { description = "id for monitor cluster_initializing_shards" - value = "${datadog_monitor.cluster_initializing_shards.*.id}" + value = datadog_monitor.cluster_initializing_shards.*.id } output "cluster_relocating_shards_id" { description = "id for monitor cluster_relocating_shards" - value = "${datadog_monitor.cluster_relocating_shards.*.id}" + value = datadog_monitor.cluster_relocating_shards.*.id } output "cluster_unassigned_shards_id" { description = "id for monitor cluster_unassigned_shards" - value = "${datadog_monitor.cluster_unassigned_shards.*.id}" + value = datadog_monitor.cluster_unassigned_shards.*.id } output "node_free_space_id" { description = "id for monitor node_free_space" - value = "${datadog_monitor.node_free_space.*.id}" + value = datadog_monitor.node_free_space.*.id } output "jvm_heap_memory_usage_id" { description = "id for monitor jvm_heap_memory_usage" - value = "${datadog_monitor.jvm_heap_memory_usage.*.id}" + value = datadog_monitor.jvm_heap_memory_usage.*.id } output "jvm_memory_young_usage_id" { description = "id for monitor jvm_memory_young_usage" - value = "${datadog_monitor.jvm_memory_young_usage.*.id}" + value = datadog_monitor.jvm_memory_young_usage.*.id } output "jvm_memory_old_usage_id" { description = "id for monitor jvm_memory_old_usage" - value = "${datadog_monitor.jvm_memory_old_usage.*.id}" + value = datadog_monitor.jvm_memory_old_usage.*.id } output "jvm_gc_old_collection_latency_id" { description = "id for monitor jvm_gc_old_collection_latency" - value = "${datadog_monitor.jvm_gc_old_collection_latency.*.id}" + value = datadog_monitor.jvm_gc_old_collection_latency.*.id } output "jvm_gc_young_collection_latency_id" { description = "id for monitor jvm_gc_young_collection_latency" - value = "${datadog_monitor.jvm_gc_young_collection_latency.*.id}" + value = datadog_monitor.jvm_gc_young_collection_latency.*.id } output "indexing_latency_id" { description = "id for monitor indexing_latency" - value = "${datadog_monitor.indexing_latency.*.id}" + value = datadog_monitor.indexing_latency.*.id } output "flush_latency_id" { description = "id for monitor flush_latency" - value = "${datadog_monitor.flush_latency.*.id}" + value = datadog_monitor.flush_latency.*.id } output "http_connections_anomaly_id" { description = "id for monitor http_connections_anomaly" - value = "${datadog_monitor.http_connections_anomaly.*.id}" + value = datadog_monitor.http_connections_anomaly.*.id } output "search_query_latency_id" { description = "id for monitor search_query_latency" - value = "${datadog_monitor.search_query_latency.*.id}" + value = datadog_monitor.search_query_latency.*.id } output "fetch_latency_id" { description = "id for monitor fetch_latency" - value = "${datadog_monitor.fetch_latency.*.id}" + value = datadog_monitor.fetch_latency.*.id } output "search_query_change_id" { description = "id for monitor search_query_change" - value = "${datadog_monitor.search_query_change.*.id}" + value = datadog_monitor.search_query_change.*.id } output "fetch_change_id" { description = "id for monitor fetch_change" - value = "${datadog_monitor.fetch_change.*.id}" + value = datadog_monitor.fetch_change.*.id } output "field_data_evictions_change_id" { description = "id for monitor field_data_evictions_change" - value = "${datadog_monitor.field_data_evictions_change.*.id}" + value = datadog_monitor.field_data_evictions_change.*.id } output "query_cache_evictions_change_id" { description = "id for monitor query_cache_evictions_change" - value = "${datadog_monitor.query_cache_evictions_change.*.id}" + value = datadog_monitor.query_cache_evictions_change.*.id } output "request_cache_evictions_change_id" { description = "id for monitor request_cache_evictions_change" - value = "${datadog_monitor.request_cache_evictions_change.*.id}" + value = datadog_monitor.request_cache_evictions_change.*.id } output "task_time_in_queue_change_id" { description = "id for monitor task_time_in_queue_change" - value = "${datadog_monitor.task_time_in_queue_change.*.id}" + value = datadog_monitor.task_time_in_queue_change.*.id } + diff --git a/database/elasticsearch/versions.tf b/database/elasticsearch/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/database/elasticsearch/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/database/mongodb/inputs.tf b/database/mongodb/inputs.tf index 0752b84..521f3ef 100644 --- a/database/mongodb/inputs.tf +++ b/database/mongodb/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -46,25 +46,25 @@ variable "mongodb_desired_servers_count" { variable "mongodb_primary_timeframe" { description = "Monitor timeframe for MongoDB wrong state for primary node [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_1m" } variable "mongodb_secondary_timeframe" { description = "Monitor timeframe for MongoDB wrong state for secondaries nodes [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } variable "mongodb_server_count_timeframe" { description = "Monitor timeframe for MongoDB wrong server count [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } variable "mongodb_replication_timeframe" { description = "Monitor timeframe for MongoDB replication lag [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_1m" } @@ -80,90 +80,91 @@ variable "mongodb_lag_critical" { variable "mongodb_primary_enabled" { description = "Flag to enable MongoDB primary state monitor" - type = "string" + type = string default = "true" } variable "mongodb_primary_extra_tags" { description = "Extra tags for MongoDB primary state monitor" - type = "list" + type = list(string) default = [] } variable "mongodb_secondary_enabled" { description = "Flag to enable MongoDB secondary state monitor" - type = "string" + type = string default = "true" } variable "mongodb_secondary_extra_tags" { description = "Extra tags for MongoDB secondary state monitor" - type = "list" + type = list(string) default = [] } variable "mongodb_server_count_enabled" { description = "Flag to enable MongoDB server count monitor" - type = "string" + type = string default = "true" } variable "mongodb_replication_enabled" { description = "Flag to enable MongoDB replication lag monitor" - type = "string" + type = string default = "true" } variable "mongodb_replication_extra_tags" { description = "Extra tags for MongoDB replication lag monitor" - type = "list" + type = list(string) default = [] } variable "mongodb_primary_message" { description = "Custom message for MongoDB primary monitor" - type = "string" + type = string default = "" } variable "mongodb_secondary_message" { description = "Custom message for MongoDB secondary monitor" - type = "string" + type = string default = "" } variable "mongodb_server_count_message" { description = "Custom message for MongoDB server count" - type = "string" + type = string default = "" } variable "mongodb_replication_message" { description = "Custom message for MongoDB replication monitor" - type = "string" + type = string default = "" } variable "mongodb_primary_aggregator" { description = "Monitor aggregator for MongoDB primary state [available values: min, max]" - type = "string" + type = string default = "max" } variable "mongodb_secondary_aggregator" { description = "Monitor aggregator for MongoDB secondary state [available values: min, max]" - type = "string" + type = string default = "max" } variable "mongodb_server_count_aggregator" { description = "Monitor aggregator for MongoDB server count [available values: min, max]" - type = "string" + type = string default = "min" } variable "mongodb_replication_aggregator" { description = "Monitor aggregator for MongoDB replication lag [available values: min, max, sum or avg]" - type = "string" + type = string default = "avg" } + diff --git a/database/mongodb/modules.tf b/database/mongodb/modules.tf index 65fdce3..1ff409d 100644 --- a/database/mongodb/modules.tf +++ b/database/mongodb/modules.tf @@ -1,20 +1,21 @@ module "filter-tags" { source = "../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "mongodb" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } module "filter-tags-secondary" { source = "../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "mongodb" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded extra_tags = ["replset_state:secondary"] } + diff --git a/database/mongodb/monitors-mongo.tf b/database/mongodb/monitors-mongo.tf index f251bf6..2e3aa0e 100644 --- a/database/mongodb/monitors-mongo.tf +++ b/database/mongodb/monitors-mongo.tf @@ -1,113 +1,111 @@ resource "datadog_monitor" "mongodb_primary" { - count = "${var.mongodb_primary_enabled == "true" ? 1 : 0}" + count = var.mongodb_primary_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB primary state" - message = "${coalesce(var.mongodb_primary_message, var.message)}" + message = coalesce(var.mongodb_primary_message, var.message) + type = "metric alert" query = <= 2 - EOQ +EOQ - type = "metric alert" - - notify_no_data = true - renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true require_full_window = true - tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", "${var.mongodb_primary_extra_tags}"] + tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", var.mongodb_primary_extra_tags] } resource "datadog_monitor" "mongodb_secondary" { - count = "${var.mongodb_secondary_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB secondary missing" - message = "${coalesce(var.mongodb_secondary_message, var.message)}" + count = var.mongodb_secondary_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB secondary missing" + message = coalesce(var.mongodb_secondary_message, var.message) + type = "query alert" query = < 1 - EOQ +EOQ - thresholds { - critical = 1 - warning = 0 - } +thresholds = { +critical = 1 +warning = 0 +} - type = "query alert" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +require_full_window = true - notify_no_data = false - renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - require_full_window = true - - tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", "${var.mongodb_secondary_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", var.mongodb_secondary_extra_tags] } resource "datadog_monitor" "mongodb_server_count" { - count = "${var.mongodb_server_count_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB too much servers or wrong monitoring config" - message = "${coalesce(var.mongodb_server_count_message, var.message)}" +count = var.mongodb_server_count_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB too much servers or wrong monitoring config" +message = coalesce(var.mongodb_server_count_message, var.message) +type = "metric alert" - query = < 99 - EOQ + +EOQ - thresholds { - critical = 99 - warning = "${var.mongodb_desired_servers_count}" - } +thresholds = { +critical = 99 +warning = var.mongodb_desired_servers_count +} - type = "metric alert" +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +require_full_window = true - notify_no_data = false - renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - require_full_window = true - - tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", "${var.mongodb_secondary_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", var.mongodb_secondary_extra_tags] } resource "datadog_monitor" "mongodb_replication" { - count = "${var.mongodb_replication_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB replication lag" - message = "${coalesce(var.mongodb_replication_message, var.message)}" +count = var.mongodb_replication_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB replication lag" +message = coalesce(var.mongodb_replication_message, var.message) +type = "metric alert" - query = < ${var.mongodb_lag_critical} - EOQ +EOQ - thresholds { - critical = "${var.mongodb_lag_critical}" - warning = "${var.mongodb_lag_warning}" + thresholds = { + critical = var.mongodb_lag_critical + warning = var.mongodb_lag_warning } - type = "metric alert" - + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" notify_audit = false timeout_h = 0 include_tags = true require_full_window = true - tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", "${var.mongodb_replication_extra_tags}"] + tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", var.mongodb_replication_extra_tags] } + diff --git a/database/mongodb/outputs.tf b/database/mongodb/outputs.tf index 4fb112b..15bf560 100644 --- a/database/mongodb/outputs.tf +++ b/database/mongodb/outputs.tf @@ -1,19 +1,20 @@ output "mongodb_primary_id" { description = "id for monitor mongodb_primary" - value = "${datadog_monitor.mongodb_primary.*.id}" + value = datadog_monitor.mongodb_primary.*.id } output "mongodb_secondary_id" { description = "id for monitor mongodb_secondary" - value = "${datadog_monitor.mongodb_secondary.*.id}" + value = datadog_monitor.mongodb_secondary.*.id } output "mongodb_server_count_id" { description = "id for monitor mongodb_server_count" - value = "${datadog_monitor.mongodb_server_count.*.id}" + value = datadog_monitor.mongodb_server_count.*.id } output "mongodb_replication_id" { description = "id for monitor mongodb_replication" - value = "${datadog_monitor.mongodb_replication.*.id}" + value = datadog_monitor.mongodb_replication.*.id } + diff --git a/database/mongodb/versions.tf b/database/mongodb/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/database/mongodb/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/database/mysql/inputs.tf b/database/mysql/inputs.tf index fe36a33..ee5344e 100644 --- a/database/mysql/inputs.tf +++ b/database/mysql/inputs.tf @@ -1,6 +1,6 @@ variable "environment" { description = "Environment" - type = "string" + type = string } variable "evaluation_delay" { @@ -45,31 +45,31 @@ variable "filter_tags_custom_excluded" { variable "mysql_availability_enabled" { description = "Flag to enable Mysql availability monitor" - type = "string" + type = string default = "true" } variable "mysql_availability_extra_tags" { description = "Extra tags for Mysql availability monitor" - type = "list" + type = list(string) default = [] } variable "mysql_availability_message" { description = "Custom message for Mysql availability monitor" - type = "string" + type = string default = "" } variable "mysql_availability_threshold_warning" { description = "Mysql availability monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "mysql_availability_no_data_timeframe" { description = "Mysql availability monitor no data timeframe" - type = "string" + type = string default = 10 } @@ -79,19 +79,19 @@ variable "mysql_availability_no_data_timeframe" { variable "mysql_connection_enabled" { description = "Flag to enable MySQL connection monitor" - type = "string" + type = string default = "true" } variable "mysql_connection_extra_tags" { description = "Extra tags for MySQL connection monitor" - type = "list" + type = list(string) default = [] } variable "mysql_connection_message" { description = "Custom message for MySQL connection monitor" - type = "string" + type = string default = "" } @@ -107,13 +107,13 @@ variable "mysql_connection_threshold_warning" { variable "mysql_connection_time_aggregator" { description = "Monitor time aggregator for MySQL connection monitor [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "mysql_connection_timeframe" { description = "Monitor timeframe for MySQL connection monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_10m" } @@ -123,19 +123,19 @@ variable "mysql_connection_timeframe" { variable "mysql_aborted_enabled" { description = "Flag to enable MySQL aborted connects monitor" - type = "string" + type = string default = "true" } variable "mysql_aborted_extra_tags" { description = "Extra tags for MySQL aborted connects monitor" - type = "list" + type = list(string) default = [] } variable "mysql_aborted_message" { description = "Custom message for MySQL aborted connects monitor" - type = "string" + type = string default = "" } @@ -151,13 +151,13 @@ variable "mysql_aborted_threshold_warning" { variable "mysql_aborted_time_aggregator" { description = "Monitor time aggregator for MySQL aborted connects monitor [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "mysql_aborted_timeframe" { description = "Monitor timeframe for MySQL aborted connects monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_10m" } @@ -167,19 +167,19 @@ variable "mysql_aborted_timeframe" { variable "mysql_slow_enabled" { description = "Flag to enable MySQL slow queries monitor" - type = "string" + type = string default = "true" } variable "mysql_slow_extra_tags" { description = "Extra tags for MySQL slow queries monitor" - type = "list" + type = list(string) default = [] } variable "mysql_slow_message" { description = "Custom message for MySQL slow queries monitor" - type = "string" + type = string default = "" } @@ -195,13 +195,13 @@ variable "mysql_slow_threshold_warning" { variable "mysql_slow_time_aggregator" { description = "Monitor time aggregator for MySQL slow queries monitor [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "mysql_slow_timeframe" { description = "Monitor timeframe for MySQL slow queries monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -211,19 +211,19 @@ variable "mysql_slow_timeframe" { variable "mysql_pool_efficiency_enabled" { description = "Flag to enable MySQL innodb buffer pool efficiency monitor" - type = "string" + type = string default = "true" } variable "mysql_pool_efficiency_extra_tags" { description = "Extra tags for MySQL innodb buffer pool efficiency monitor" - type = "list" + type = list(string) default = [] } variable "mysql_pool_efficiency_message" { description = "Custom message for MySQL innodb buffer pool efficiency monitor" - type = "string" + type = string default = "" } @@ -239,13 +239,13 @@ variable "mysql_pool_efficiency_threshold_warning" { variable "mysql_pool_efficiency_time_aggregator" { description = "Monitor time aggregator for MySQL innodb buffer pool efficiency monitor [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "mysql_pool_efficiency_timeframe" { description = "Monitor timeframe for MySQL innodb buffer pool efficiency monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_1h" } @@ -255,19 +255,19 @@ variable "mysql_pool_efficiency_timeframe" { variable "mysql_pool_utilization_enabled" { description = "Flag to enable MySQL innodb buffer pool utilization monitor" - type = "string" + type = string default = "true" } variable "mysql_pool_utilization_extra_tags" { description = "Extra tags for MySQL innodb buffer pool utilization monitor" - type = "list" + type = list(string) default = [] } variable "mysql_pool_utilization_message" { description = "Custom message for MySQL innodb buffer pool utilization monitor" - type = "string" + type = string default = "" } @@ -283,13 +283,13 @@ variable "mysql_pool_utilization_threshold_warning" { variable "mysql_pool_utilization_time_aggregator" { description = "Monitor time aggregator for MySQL innodb buffer pool utilization monitor [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "mysql_pool_utilization_timeframe" { description = "Monitor timeframe for MySQL innodb buffer pool utilization monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_1h" } @@ -299,19 +299,19 @@ variable "mysql_pool_utilization_timeframe" { variable "mysql_threads_enabled" { description = "Flag to enable mysql threads monitor" - type = "string" + type = string default = "true" } variable "mysql_threads_extra_tags" { description = "Extra tags for MySQL threads monitor" - type = "list" + type = list(string) default = [] } variable "mysql_threads_message" { description = "Custom message for MySQL threads monitor" - type = "string" + type = string default = "" } @@ -322,55 +322,55 @@ variable "mysql_threads_threshold_critical" { variable "mysql_threads_detection_algorithm" { description = "Anomaly Detection Algorithm used" - type = "string" + type = string default = "basic" } variable "mysql_threads_deviations" { description = "Deviations to detect the anomaly" - type = "string" + type = string default = 2 } variable "mysql_threads_direction" { description = "Direction of the anomaly. It can be both, below or above." - type = "string" + type = string default = "above" } variable "mysql_threads_alert_window" { description = "Alert window." - type = "string" + type = string default = "last_15m" } variable "mysql_threads_interval" { description = "Interval." - type = "string" + type = string default = 60 } variable "mysql_threads_count_default_zero" { description = "Count default zero." - type = "string" + type = string default = "true" } variable "mysql_threads_seasonality" { description = "Seasonality of the algorithm" - type = "string" + type = string default = "daily" } variable "mysql_threads_time_aggregator" { description = "Monitor time aggregator for MySQL threads monitor [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "mysql_threads_timeframe" { description = "Monitor timeframe for MySQL threads monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_4h" } @@ -380,19 +380,19 @@ variable "mysql_threads_timeframe" { variable "mysql_questions_enabled" { description = "Flag to enable mysql queries monitor" - type = "string" + type = string default = "true" } variable "mysql_questions_extra_tags" { description = "Extra tags for MySQL queries monitor" - type = "list" + type = list(string) default = [] } variable "mysql_questions_message" { description = "Custom message for MySQL queries monitor" - type = "string" + type = string default = "" } @@ -403,54 +403,55 @@ variable "mysql_questions_threshold_critical" { variable "mysql_questions_detection_algorithm" { description = "Anomaly Detection Algorithm used" - type = "string" + type = string default = "agile" } variable "mysql_questions_deviations" { description = "Deviations to detect the anomaly" - type = "string" + type = string default = 5 } variable "mysql_questions_direction" { description = "Direction of the anomaly. It can be both, below or above." - type = "string" + type = string default = "both" } variable "mysql_questions_alert_window" { description = "Alert window." - type = "string" + type = string default = "last_15m" } variable "mysql_questions_interval" { description = "Interval." - type = "string" + type = string default = 60 } variable "mysql_questions_count_default_zero" { description = "Count default zero." - type = "string" + type = string default = "true" } variable "mysql_questions_seasonality" { description = "Seasonality of the algorithm" - type = "string" + type = string default = "daily" } variable "mysql_questions_time_aggregator" { description = "Monitor time aggregator for MySQL queries monitor [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "mysql_questions_timeframe" { description = "Monitor timeframe for MySQL queries monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_4h" } + diff --git a/database/mysql/modules.tf b/database/mysql/modules.tf index 90ef22e..37d1850 100644 --- a/database/mysql/modules.tf +++ b/database/mysql/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "mysql" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/database/mysql/monitors-mysql.tf b/database/mysql/monitors-mysql.tf index d599e88..31511fe 100644 --- a/database/mysql/monitors-mysql.tf +++ b/database/mysql/monitors-mysql.tf @@ -1,36 +1,35 @@ resource "datadog_monitor" "mysql_availability" { - count = "${var.mysql_availability_enabled == "true" ? 1 : 0}" + count = var.mysql_availability_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql server does not respond" - message = "${coalesce(var.mysql_availability_message, var.message)}" - + message = coalesce(var.mysql_availability_message, var.message) type = "service check" query = < ${var.mysql_connection_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +warning = var.mysql_connection_threshold_warning +critical = var.mysql_connection_threshold_critical +} - thresholds { - warning = "${var.mysql_connection_threshold_warning}" - critical = "${var.mysql_connection_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = true +timeout_h = 0 +include_tags = true - notify_no_data = false - renotify_interval = 0 - require_full_window = true - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_connection_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_connection_extra_tags] } resource "datadog_monitor" "mysql_aborted" { - count = "${var.mysql_aborted_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Aborted connects {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.mysql_aborted_message, var.message)}" - type = "query alert" +count = var.mysql_aborted_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Aborted connects {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.mysql_aborted_message, var.message) +type = "query alert" - query = < ${var.mysql_aborted_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +warning = var.mysql_aborted_threshold_warning +critical = var.mysql_aborted_threshold_critical +} - thresholds { - warning = "${var.mysql_aborted_threshold_warning}" - critical = "${var.mysql_aborted_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = true +timeout_h = 0 +include_tags = true - notify_no_data = false - renotify_interval = 0 - require_full_window = true - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_aborted_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_aborted_extra_tags] } resource "datadog_monitor" "mysql_slow" { - count = "${var.mysql_slow_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Slow queries {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.mysql_slow_message, var.message)}" - type = "query alert" +count = var.mysql_slow_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Slow queries {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.mysql_slow_message, var.message) +type = "query alert" - query = < ${var.mysql_slow_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.mysql_slow_threshold_warning}" - critical = "${var.mysql_slow_threshold_critical}" + thresholds = { + warning = var.mysql_slow_threshold_warning + critical = var.mysql_slow_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_slow_extra_tags}"] + tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_slow_extra_tags] } resource "datadog_monitor" "mysql_pool_efficiency" { - count = "${var.mysql_pool_efficiency_enabled == "true" ? 1 : 0}" + count = var.mysql_pool_efficiency_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Innodb buffer pool efficiency {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.mysql_pool_efficiency_message, var.message)}" + message = coalesce(var.mysql_pool_efficiency_message, var.message) type = "query alert" query = < ${var.mysql_pool_efficiency_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.mysql_pool_efficiency_threshold_warning}" - critical = "${var.mysql_pool_efficiency_threshold_critical}" + thresholds = { + warning = var.mysql_pool_efficiency_threshold_warning + critical = var.mysql_pool_efficiency_threshold_critical } - notify_no_data = false - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 require_full_window = true - timeout_h = 0 - include_tags = true + timeout_h = 0 + include_tags = true - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_pool_efficiency_extra_tags}"] + tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_pool_efficiency_extra_tags] } resource "datadog_monitor" "mysql_pool_utilization" { - count = "${var.mysql_pool_utilization_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Innodb buffer pool utilization {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.mysql_pool_utilization_message, var.message)}" + count = var.mysql_pool_utilization_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Innodb buffer pool utilization {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.mysql_pool_utilization_message, var.message) type = "query alert" query = < ${var.mysql_pool_utilization_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +warning = var.mysql_pool_utilization_threshold_warning +critical = var.mysql_pool_utilization_threshold_critical +} - thresholds { - warning = "${var.mysql_pool_utilization_threshold_warning}" - critical = "${var.mysql_pool_utilization_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = true +timeout_h = 0 +include_tags = true - notify_no_data = false - renotify_interval = 0 - require_full_window = true - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_pool_utilization_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_pool_utilization_extra_tags] } resource "datadog_monitor" "mysql_threads_anomaly" { - count = "${var.mysql_threads_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql threads changed abnormally" - message = "${coalesce(var.mysql_threads_message, var.message)}" - type = "metric alert" +count = var.mysql_threads_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql threads changed abnormally" +message = coalesce(var.mysql_threads_message, var.message) +type = "metric alert" - query = <= ${var.mysql_threads_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +critical = var.mysql_threads_threshold_critical +critical_recovery = 0 +} - thresholds { - critical = "${var.mysql_threads_threshold_critical}" - critical_recovery = 0 - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = true +timeout_h = 0 +include_tags = true - notify_no_data = false - renotify_interval = 0 - require_full_window = true - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_threads_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_threads_extra_tags] } resource "datadog_monitor" "mysql_questions_anomaly" { - count = "${var.mysql_questions_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql queries changed abnormally" - message = "${coalesce(var.mysql_questions_message, var.message)}" - type = "metric alert" +count = var.mysql_questions_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql queries changed abnormally" +message = coalesce(var.mysql_questions_message, var.message) +type = "metric alert" - query = <= ${var.mysql_questions_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - critical = "${var.mysql_questions_threshold_critical}" + thresholds = { + critical = var.mysql_questions_threshold_critical critical_recovery = 0 } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = true timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", "${var.mysql_questions_extra_tags}"] + tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_questions_extra_tags] } + diff --git a/database/mysql/outputs.tf b/database/mysql/outputs.tf index 0c35ddc..0e1681c 100644 --- a/database/mysql/outputs.tf +++ b/database/mysql/outputs.tf @@ -1,39 +1,40 @@ output "mysql_availability_id" { description = "id for monitor mysql_availability" - value = "${datadog_monitor.mysql_availability.*.id}" + value = datadog_monitor.mysql_availability.*.id } output "mysql_connection_id" { description = "id for monitor mysql_connection" - value = "${datadog_monitor.mysql_connection.*.id}" + value = datadog_monitor.mysql_connection.*.id } output "mysql_aborted_id" { description = "id for monitor mysql_aborted" - value = "${datadog_monitor.mysql_aborted.*.id}" + value = datadog_monitor.mysql_aborted.*.id } output "mysql_slow_id" { description = "id for monitor mysql_slow" - value = "${datadog_monitor.mysql_slow.*.id}" + value = datadog_monitor.mysql_slow.*.id } output "mysql_pool_efficiency_id" { description = "id for monitor mysql_pool_efficiency" - value = "${datadog_monitor.mysql_pool_efficiency.*.id}" + value = datadog_monitor.mysql_pool_efficiency.*.id } output "mysql_pool_utilization_id" { description = "id for monitor mysql_pool_utilization" - value = "${datadog_monitor.mysql_pool_utilization.*.id}" + value = datadog_monitor.mysql_pool_utilization.*.id } output "mysql_threads_anomaly_id" { description = "id for monitor mysql_threads_anomaly" - value = "${datadog_monitor.mysql_threads_anomaly.*.id}" + value = datadog_monitor.mysql_threads_anomaly.*.id } output "mysql_questions_anomaly_id" { description = "id for monitor mysql_questions_anomaly" - value = "${datadog_monitor.mysql_questions_anomaly.*.id}" + value = datadog_monitor.mysql_questions_anomaly.*.id } + diff --git a/database/mysql/versions.tf b/database/mysql/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/database/mysql/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/database/postgresql/inputs.tf b/database/postgresql/inputs.tf index e761e1e..b505161 100644 --- a/database/postgresql/inputs.tf +++ b/database/postgresql/inputs.tf @@ -1,6 +1,6 @@ variable "environment" { description = "Environment" - type = "string" + type = string } # Global DataDog @@ -45,31 +45,31 @@ variable "filter_tags_custom_excluded" { variable "postgresql_availability_enabled" { description = "Flag to enable PostgreSQL availability monitor" - type = "string" + type = string default = "true" } variable "postgresql_availability_extra_tags" { description = "Extra tags for PostgreSQL availability monitor" - type = "list" + type = list(string) default = [] } variable "postgresql_availability_message" { description = "Custom message for PostgreSQL availability monitor" - type = "string" + type = string default = "" } variable "postgresql_availability_threshold_warning" { description = "PostgreSQL availability monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "postgresql_availability_no_data_timeframe" { description = "PostgreSQL availability monitor no data timeframe" - type = "string" + type = string default = 10 } @@ -89,31 +89,31 @@ variable "postgresql_connection_threshold_warning" { variable "postgresql_connection_enabled" { description = "Flag to enable PostgreSQL connection monitor" - type = "string" + type = string default = "true" } variable "postgresql_connection_extra_tags" { description = "Extra tags for PostgreSQL connection connects monitor" - type = "list" + type = list(string) default = [] } variable "postgresql_connection_message" { description = "Custom message for PostgreSQL connection monitor" - type = "string" + type = string default = "" } variable "postgresql_connection_time_aggregator" { description = "Monitor time aggregator for PostgreSQL connection monitor [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "postgresql_connection_timeframe" { description = "Monitor timeframe for PostgreSQL connection monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -133,30 +133,31 @@ variable "postgresql_lock_threshold_warning" { variable "postgresql_lock_enabled" { description = "Flag to enable PostgreSQL lock monitor" - type = "string" + type = string default = "true" } variable "postgresql_lock_extra_tags" { description = "Extra tags for PostgreSQL lock connects monitor" - type = "list" + type = list(string) default = [] } variable "postgresql_lock_message" { description = "Custom message for PostgreSQL lock monitor" - type = "string" + type = string default = "" } variable "postgresql_lock_time_aggregator" { description = "Monitor time aggregator for PostgreSQL lock monitor [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "postgresql_lock_timeframe" { description = "Monitor timeframe for PostgreSQL lock monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } + diff --git a/database/postgresql/modules.tf b/database/postgresql/modules.tf index b18547d..4004ab7 100644 --- a/database/postgresql/modules.tf +++ b/database/postgresql/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "postgres" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/database/postgresql/monitors-postgresql.tf b/database/postgresql/monitors-postgresql.tf index 2612638..230a466 100644 --- a/database/postgresql/monitors-postgresql.tf +++ b/database/postgresql/monitors-postgresql.tf @@ -1,86 +1,84 @@ resource "datadog_monitor" "postgresql_availability" { - count = "${var.postgresql_availability_enabled == "true" ? 1 : 0}" + count = var.postgresql_availability_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] PostgreSQL server does not respond" - message = "${coalesce(var.postgresql_availability_message, var.message)}" - + message = coalesce(var.postgresql_availability_message, var.message) type = "service check" query = < ${var.postgresql_connection_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" +thresholds = { +warning = var.postgresql_connection_threshold_warning +critical = var.postgresql_connection_threshold_critical +} - thresholds { - warning = "${var.postgresql_connection_threshold_warning}" - critical = "${var.postgresql_connection_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = true +timeout_h = 0 +include_tags = true - notify_no_data = false - renotify_interval = 0 - require_full_window = true - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform", "${var.postgresql_connection_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform", var.postgresql_connection_extra_tags] } resource "datadog_monitor" "postgresql_too_many_locks" { - count = "${var.postgresql_lock_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] PostgreSQL too many locks {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.postgresql_lock_message, var.message)}" - type = "query alert" +count = var.postgresql_lock_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] PostgreSQL too many locks {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" +message = coalesce(var.postgresql_lock_message, var.message) +type = "query alert" - query = < ${var.postgresql_lock_threshold_critical} - EOQ +EOQ - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - thresholds { - warning = "${var.postgresql_lock_threshold_warning}" - critical = "${var.postgresql_lock_threshold_critical}" - } - - notify_no_data = false - renotify_interval = 0 - require_full_window = true - timeout_h = 0 - include_tags = true - - tags = ["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform", "${var.postgresql_lock_extra_tags}"] +thresholds = { +warning = var.postgresql_lock_threshold_warning +critical = var.postgresql_lock_threshold_critical } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +require_full_window = true +timeout_h = 0 +include_tags = true + +tags = ["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform", var.postgresql_lock_extra_tags] +} + diff --git a/database/postgresql/outputs.tf b/database/postgresql/outputs.tf index 24c26d1..bb81f0b 100644 --- a/database/postgresql/outputs.tf +++ b/database/postgresql/outputs.tf @@ -1,14 +1,15 @@ output "postgresql_availability_id" { description = "id for monitor postgresql_availability" - value = "${datadog_monitor.postgresql_availability.*.id}" + value = datadog_monitor.postgresql_availability.*.id } output "postgresql_connection_too_high_id" { description = "id for monitor postgresql_connection_too_high" - value = "${datadog_monitor.postgresql_connection_too_high.*.id}" + value = datadog_monitor.postgresql_connection_too_high.*.id } output "postgresql_too_many_locks_id" { description = "id for monitor postgresql_too_many_locks" - value = "${datadog_monitor.postgresql_too_many_locks.*.id}" + value = datadog_monitor.postgresql_too_many_locks.*.id } + diff --git a/database/postgresql/versions.tf b/database/postgresql/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/database/postgresql/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/database/redis/inputs.tf b/database/redis/inputs.tf index 7866bec..7ecc6d9 100644 --- a/database/redis/inputs.tf +++ b/database/redis/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture environment" - type = "string" + type = string } # Global DataDog @@ -43,31 +43,31 @@ variable "filter_tags_custom_excluded" { variable "evictedkeys_change_enabled" { description = "Flag to enable Redis evicted keys monitor" - type = "string" + type = string default = "true" } variable "evictedkeys_change_message" { description = "Custom message for Redis evicted keys monitor" - type = "string" + type = string default = "" } variable "evictedkeys_change_extra_tags" { description = "Extra tags for Redis evicted keys monitor" - type = "list" + type = list(string) default = [] } variable "evictedkeys_change_time_aggregator" { description = "Monitor aggregator for Redis evicted keys [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "evictedkeys_change_timeframe" { description = "Monitor timeframe for Redis evicted keys [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -83,31 +83,31 @@ variable "evictedkeys_change_threshold_critical" { variable "expirations_rate_enabled" { description = "Flag to enable Redis keys expirations monitor" - type = "string" + type = string default = "true" } variable "expirations_rate_message" { description = "Custom message for Redis keys expirations monitor" - type = "string" + type = string default = "" } variable "expirations_rate_extra_tags" { description = "Extra tags for Redis keys expirations monitor" - type = "list" + type = list(string) default = [] } variable "expirations_rate_time_aggregator" { description = "Monitor aggregator for Redis keys expirations [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "expirations_rate_timeframe" { description = "Monitor timeframe for Redis keys expirations [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -123,31 +123,31 @@ variable "expirations_rate_threshold_warning" { variable "blocked_clients_enabled" { description = "Flag to enable Redis Blocked clients monitor" - type = "string" + type = string default = "true" } variable "blocked_clients_message" { description = "Custom message for Redis Blocked clients monitor" - type = "string" + type = string default = "" } variable "blocked_clients_extra_tags" { description = "Extra tags for Redis Blocked clients monitor" - type = "list" + type = list(string) default = [] } variable "blocked_clients_time_aggregator" { description = "Monitor aggregator for Redis Blocked clients [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "blocked_clients_timeframe" { description = "Monitor timeframe for Redis Blocked clients [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -163,31 +163,31 @@ variable "blocked_clients_threshold_warning" { variable "keyspace_enabled" { description = "Flag to enable Redis keyspace monitor" - type = "string" + type = string default = "true" } variable "keyspace_message" { description = "Custom message for Redis keyspace monitor" - type = "string" + type = string default = "" } variable "keyspace_extra_tags" { description = "Extra tags for Redis keyspace monitor" - type = "list" + type = list(string) default = [] } variable "keyspace_time_aggregator" { description = "Monitor aggregator for Redis keyspace [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "keyspace_timeframe" { description = "Monitor timeframe for Redis keyspace [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -203,31 +203,31 @@ variable "keyspace_threshold_warning" { variable "mem_used_enabled" { description = "Flag to enable Redis RAM memory used monitor" - type = "string" + type = string default = "true" } variable "mem_used_message" { description = "Custom message for Redis RAM memory used monitor" - type = "string" + type = string default = "" } variable "mem_used_extra_tags" { description = "Extra tags for Redis RAM memory used monitor" - type = "list" + type = list(string) default = [] } variable "mem_used_time_aggregator" { description = "Monitor aggregator for Redis RAM memory used [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "mem_used_timeframe" { description = "Monitor timeframe for Redis RAM memory used [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -243,31 +243,31 @@ variable "mem_used_threshold_warning" { variable "mem_frag_enabled" { description = "Flag to enable Redis memory RAM fragmentation monitor" - type = "string" + type = string default = "true" } variable "mem_frag_message" { description = "Custom message for Redis memory RAM fragmentation monitor" - type = "string" + type = string default = "" } variable "mem_frag_extra_tags" { description = "Extra tags for Redis memory RAM fragmentation monitor" - type = "list" + type = list(string) default = [] } variable "mem_frag_time_aggregator" { description = "Monitor aggregator for Redis memory RAM fragmentation [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "mem_frag_timeframe" { description = "Monitor timeframe for Redis memory RAM fragmentation [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -283,31 +283,31 @@ variable "mem_frag_threshold_warning" { variable "rejected_con_enabled" { description = "Flag to enable Redis rejected connections errors monitor" - type = "string" + type = string default = "true" } variable "rejected_con_message" { description = "Custom message for Redis rejected connections errors monitor" - type = "string" + type = string default = "" } variable "rejected_con_extra_tags" { description = "Extra tags for Redis rejected connections errors monitor" - type = "list" + type = list(string) default = [] } variable "rejected_con_time_aggregator" { description = "Monitor aggregator for Redis rejected connections errors [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "rejected_con_timeframe" { description = "Monitor timeframe for Redis rejected connections errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -323,31 +323,31 @@ variable "rejected_con_threshold_warning" { variable "latency_enabled" { description = "Flag to enable Redis latency monitor" - type = "string" + type = string default = "true" } variable "latency_message" { description = "Custom message for Redis latency monitor" - type = "string" + type = string default = "" } variable "latency_extra_tags" { description = "Extra tags for Redis latency monitor" - type = "list" + type = list(string) default = [] } variable "latency_time_aggregator" { description = "Monitor aggregator for Redis latency [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "latency_timeframe" { description = "Monitor timeframe for Redis latency [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -363,31 +363,31 @@ variable "latency_threshold_warning" { variable "hitrate_enabled" { description = "Flag to enable Redis hitrate monitor" - type = "string" + type = string default = "true" } variable "hitrate_message" { description = "Custom message for Redis hitrate monitor" - type = "string" + type = string default = "" } variable "hitrate_extra_tags" { description = "Extra tags for Redis hitrate monitor" - type = "list" + type = list(string) default = [] } variable "hitrate_time_aggregator" { description = "Monitor aggregator for Redis hitrate [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "hitrate_timeframe" { description = "Monitor timeframe for Redis hitrate [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -407,30 +407,31 @@ variable "hitrate_threshold_warning" { variable "not_responding_enabled" { description = "Flag to enable Redis does not respond monitor" - type = "string" + type = string default = "true" } variable "not_responding_message" { description = "Custom message for Redis does not respond monitor" - type = "string" + type = string default = "" } variable "not_responding_extra_tags" { description = "Extra tags for Redis does not respond monitor" - type = "list" + type = list(string) default = [] } variable "not_responding_threshold_warning" { description = "Redis does not respond monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "not_responding_no_data_timeframe" { description = "Redis does not respond monitor no data timeframe" - type = "string" + type = string default = 10 } + diff --git a/database/redis/modules.tf b/database/redis/modules.tf index 5223605..f923fe0 100644 --- a/database/redis/modules.tf +++ b/database/redis/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "redis" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/database/redis/monitors-redis.tf b/database/redis/monitors-redis.tf index b2ce347..51568b6 100644 --- a/database/redis/monitors-redis.tf +++ b/database/redis/monitors-redis.tf @@ -2,289 +2,280 @@ # Service Check # resource "datadog_monitor" "not_responding" { - count = "${var.not_responding_enabled == "true" ? 1 : 0}" + count = var.not_responding_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis does not respond" - message = "${coalesce(var.not_responding_message, var.message)}" - + message = coalesce(var.not_responding_message, var.message) type = "service check" query = < ${var.evictedkeys_change_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.evictedkeys_change_threshold_warning +critical = var.evictedkeys_change_threshold_critical +} - thresholds { - warning = "${var.evictedkeys_change_threshold_warning}" - critical = "${var.evictedkeys_change_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = true - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.evictedkeys_change_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.evictedkeys_change_extra_tags] } resource "datadog_monitor" "expirations" { - count = "${var.expirations_rate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis expired keys {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.expirations_rate_message, var.message)}" +count = var.expirations_rate_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis expired keys {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.expirations_rate_message, var.message) +type = "query alert" - query = < ${var.expirations_rate_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.expirations_rate_threshold_warning +critical = var.expirations_rate_threshold_critical +} - thresholds { - warning = "${var.expirations_rate_threshold_warning}" - critical = "${var.expirations_rate_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.expirations_rate_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.expirations_rate_extra_tags] } resource "datadog_monitor" "blocked_clients" { - count = "${var.blocked_clients_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis blocked clients {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.blocked_clients_message, var.message)}" +count = var.blocked_clients_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis blocked clients {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.blocked_clients_message, var.message) +type = "query alert" - query = < ${var.blocked_clients_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.blocked_clients_threshold_warning}" - critical = "${var.blocked_clients_threshold_critical}" + thresholds = { + warning = var.blocked_clients_threshold_warning + critical = var.blocked_clients_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.blocked_clients_extra_tags}"] + tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.blocked_clients_extra_tags] } resource "datadog_monitor" "keyspace_full" { - count = "${var.keyspace_enabled == "true" ? 1 : 0}" + count = var.keyspace_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis keyspace seems full (no changes since ${var.keyspace_timeframe})" - message = "${coalesce(var.keyspace_message, var.message)}" + message = coalesce(var.keyspace_message, var.message) + type = "query alert" query = < ${var.mem_used_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.mem_used_threshold_warning +critical = var.mem_used_threshold_critical +} - thresholds { - warning = "${var.mem_used_threshold_warning}" - critical = "${var.mem_used_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.mem_used_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.mem_used_extra_tags] } resource "datadog_monitor" "memory_frag" { - count = "${var.mem_frag_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis memory fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.mem_frag_message, var.message)}" +count = var.mem_frag_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis memory fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.mem_frag_message, var.message) +type = "query alert" - query = < ${var.mem_frag_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.mem_frag_threshold_warning +critical = var.mem_frag_threshold_critical +} - thresholds { - warning = "${var.mem_frag_threshold_warning}" - critical = "${var.mem_frag_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +renotify_interval = 0 +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = false - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = false - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.mem_frag_extra_tags}"] +tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.mem_frag_extra_tags] } resource "datadog_monitor" "rejected_connections" { - count = "${var.rejected_con_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis rejected connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.rejected_con_message, var.message)}" +count = var.rejected_con_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis rejected connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" +message = coalesce(var.rejected_con_message, var.message) +type = "query alert" - query = < ${var.rejected_con_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.rejected_con_threshold_warning}" - critical = "${var.rejected_con_threshold_critical}" + thresholds = { + warning = var.rejected_con_threshold_warning + critical = var.rejected_con_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.rejected_con_extra_tags}"] + tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.rejected_con_extra_tags] } resource "datadog_monitor" "latency" { - count = "${var.latency_enabled == "true" ? 1 : 0}" + count = var.latency_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}){{/is_warning}}" - message = "${coalesce(var.latency_message, var.message)}" + message = coalesce(var.latency_message, var.message) + type = "query alert" query = < ${var.latency_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.latency_threshold_warning}" - critical = "${var.latency_threshold_critical}" + thresholds = { + warning = var.latency_threshold_warning + critical = var.latency_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - new_host_delay = "${var.new_host_delay}" - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", "${var.latency_extra_tags}"] + tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.latency_extra_tags] } resource "datadog_monitor" "hitrate" { - count = "${var.hitrate_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis hitrate {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.hitrate_message, var.message)}" + count = var.hitrate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis hitrate {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.hitrate_message, var.message) + type = "query alert" query = < ${var.nginx_dropped_threshold_critical} - EOQ +EOQ - thresholds { - critical = "${var.nginx_dropped_threshold_critical}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - - tags = ["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform", "${var.nginx_dropped_extra_tags}"] +thresholds = { +critical = var.nginx_dropped_threshold_critical } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = true + +tags = ["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform", var.nginx_dropped_extra_tags] +} + diff --git a/middleware/nginx/outputs.tf b/middleware/nginx/outputs.tf index 970174c..33dacc8 100644 --- a/middleware/nginx/outputs.tf +++ b/middleware/nginx/outputs.tf @@ -1,9 +1,10 @@ output "datadog_nginx_process_id" { description = "id for monitor datadog_nginx_process" - value = "${datadog_monitor.datadog_nginx_process.*.id}" + value = datadog_monitor.datadog_nginx_process.*.id } output "datadog_nginx_dropped_connections_id" { description = "id for monitor datadog_nginx_dropped_connections" - value = "${datadog_monitor.datadog_nginx_dropped_connections.*.id}" + value = datadog_monitor.datadog_nginx_dropped_connections.*.id } + diff --git a/middleware/nginx/versions.tf b/middleware/nginx/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/middleware/nginx/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/middleware/php-fpm/inputs.tf b/middleware/php-fpm/inputs.tf index 4887ecd..95ce388 100644 --- a/middleware/php-fpm/inputs.tf +++ b/middleware/php-fpm/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -43,31 +43,31 @@ variable "filter_tags_custom_excluded" { variable "php_fpm_busy_enabled" { description = "Flag to enable PHP FPM busy worker monitor" - type = "string" + type = string default = "true" } variable "php_fpm_busy_extra_tags" { description = "Extra tags for PHP FPM busy worker monitor" - type = "list" + type = list(string) default = [] } variable "php_fpm_busy_message" { description = "Custom message for PHP FPM busy worker monitor" - type = "string" + type = string default = "" } variable "php_fpm_busy_time_aggregator" { description = "Monitor aggregator for PHP FPM busy worker [available values: min, max or avg]" - type = "string" + type = string default = "avg" } variable "php_fpm_busy_timeframe" { description = "Monitor timeframe for PHP FPM busy worker [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_10m" } @@ -83,30 +83,31 @@ variable "php_fpm_busy_threshold_critical" { variable "php_fpm_connect_enabled" { description = "Flag to enable PHP FPM status monitor" - type = "string" + type = string default = "true" } variable "php_fpm_connect_extra_tags" { description = "Extra tags for PHP FPM status monitor" - type = "list" + type = list(string) default = [] } variable "php_fpm_connect_message" { description = "Custom message for PHP FPM status monitor" - type = "string" + type = string default = "" } variable "php_fpm_connect_threshold_warning" { description = "PHP FPM status monitor (warning threshold)" - type = "string" + type = string default = 3 } variable "php_fpm_connect_no_data_timeframe" { description = "PHP FPM status monitor no data timeframe" - type = "string" + type = string default = 10 } + diff --git a/middleware/php-fpm/modules.tf b/middleware/php-fpm/modules.tf index 3f2f324..9d90639 100644 --- a/middleware/php-fpm/modules.tf +++ b/middleware/php-fpm/modules.tf @@ -1,9 +1,10 @@ module "filter-tags" { source = "../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "php-fpm" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } + diff --git a/middleware/php-fpm/monitors-fpm.tf b/middleware/php-fpm/monitors-fpm.tf index 464cd5e..9f5984d 100644 --- a/middleware/php-fpm/monitors-fpm.tf +++ b/middleware/php-fpm/monitors-fpm.tf @@ -1,37 +1,35 @@ resource "datadog_monitor" "php_fpm_connect" { - count = "${var.php_fpm_connect_enabled == "true" ? 1 : 0}" + count = var.php_fpm_connect_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Php-fpm ping url does not respond" - message = "${coalesce(var.php_fpm_connect_message, var.message)}" - + message = coalesce(var.php_fpm_connect_message, var.message) type = "service check" query = < ${var.php_fpm_busy_threshold_critical} - EOQ +EOQ - thresholds { - warning = "${var.php_fpm_busy_threshold_warning}" - critical = "${var.php_fpm_busy_threshold_critical}" - } - - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - - tags = ["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform", "${var.php_fpm_busy_extra_tags}"] +thresholds = { +warning = var.php_fpm_busy_threshold_warning +critical = var.php_fpm_busy_threshold_critical } + +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = true + +tags = ["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform", var.php_fpm_busy_extra_tags] +} + diff --git a/middleware/php-fpm/outputs.tf b/middleware/php-fpm/outputs.tf index 5aa48d2..1d7408a 100644 --- a/middleware/php-fpm/outputs.tf +++ b/middleware/php-fpm/outputs.tf @@ -1,9 +1,10 @@ output "php_fpm_connect_id" { description = "id for monitor php_fpm_connect" - value = "${datadog_monitor.php_fpm_connect.*.id}" + value = datadog_monitor.php_fpm_connect.*.id } output "php_fpm_connect_idle_id" { description = "id for monitor php_fpm_connect_idle" - value = "${datadog_monitor.php_fpm_connect_idle.*.id}" + value = datadog_monitor.php_fpm_connect_idle.*.id } + diff --git a/middleware/php-fpm/versions.tf b/middleware/php-fpm/versions.tf new file mode 100644 index 0000000..ac97c6a --- /dev/null +++ b/middleware/php-fpm/versions.tf @@ -0,0 +1,4 @@ + +terraform { + required_version = ">= 0.12" +} diff --git a/system/generic/inputs.tf b/system/generic/inputs.tf index 0b0b52a..49c0c39 100644 --- a/system/generic/inputs.tf +++ b/system/generic/inputs.tf @@ -1,7 +1,7 @@ # Global Terraform variable "environment" { description = "Architecture Environment" - type = "string" + type = string } # Global DataDog @@ -43,31 +43,31 @@ variable "filter_tags_custom_excluded" { variable "cpu_enabled" { description = "Flag to enable CPU high monitor" - type = "string" + type = string default = "true" } variable "cpu_extra_tags" { description = "Extra tags for CPU high monitor" - type = "list" + type = list(string) default = [] } variable "cpu_message" { description = "Custom message for CPU high monitor" - type = "string" + type = string default = "" } variable "cpu_time_aggregator" { description = "Monitor aggregator for CPU high [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "cpu_timeframe" { description = "Monitor timeframe for CPU high [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_10m" } @@ -83,31 +83,31 @@ variable "cpu_threshold_critical" { variable "load_enabled" { description = "Flag to enable CPU load ratio monitor" - type = "string" + type = string default = "true" } variable "load_extra_tags" { description = "Extra tags for CPU load ratio monitor" - type = "list" + type = list(string) default = [] } variable "load_message" { description = "Custom message for CPU load ratio monitor" - type = "string" + type = string default = "" } variable "load_time_aggregator" { description = "Monitor aggregator for CPU load ratio [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "load_timeframe" { description = "Monitor timeframe for CPU load ratio [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_15m" } @@ -123,31 +123,31 @@ variable "load_threshold_critical" { variable "disk_space_enabled" { description = "Flag to enable Free diskspace monitor" - type = "string" + type = string default = "true" } variable "disk_space_extra_tags" { description = "Extra tags for Free diskspace monitor" - type = "list" + type = list(string) default = [] } variable "disk_space_message" { description = "Custom message for Free diskspace monitor" - type = "string" + type = string default = "" } variable "disk_space_time_aggregator" { description = "Monitor aggregator for Free diskspace [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "disk_space_timeframe" { description = "Monitor timeframe for Free diskspace [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -163,67 +163,67 @@ variable "disk_space_threshold_critical" { variable "disk_space_forecast_enabled" { description = "Flag to enable Free diskspace forecast monitor" - type = "string" + type = string default = "true" } variable "disk_space_forecast_extra_tags" { description = "Extra tags for Free diskspace forecast monitor" - type = "list" + type = list(string) default = [] } variable "disk_space_forecast_message" { description = "Custom message for Free diskspace forecast monitor" - type = "string" + type = string default = "" } variable "disk_space_forecast_time_aggregator" { description = "Monitor aggregator for Free diskspace forecast [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "disk_space_forecast_timeframe" { description = "Monitor timeframe for Free diskspace forecast [available values: `next_12h`, `next_#d` (1, 2, or 3), `next_#w` (1 or 2) or `next_#mo` (1, 2 or 3)]" - type = "string" + type = string default = "next_1w" } variable "disk_space_forecast_algorithm" { description = "Algorithm for the Free diskspace Forecast monitor [available values: `linear` or `seasonal`]" - type = "string" + type = string default = "linear" } variable "disk_space_forecast_deviations" { description = "Deviations for the Free diskspace Forecast monitor [available values: `1`, `2`, `3`, `4` or `5`]" - type = "string" + type = string default = 1 } variable "disk_space_forecast_interval" { description = "Interval for the Free diskspace Forecast monitor [available values: `30m`, `60m` or `120m`]" - type = "string" + type = string default = "60m" } variable "disk_space_forecast_linear_history" { description = "History for the Free diskspace Forecast monitor [available values: `12h`, `#d` (1, 2, or 3), `#w` (1, or 2) or `#mo` (1, 2 or 3)]" - type = "string" + type = string default = "1w" } variable "disk_space_forecast_linear_model" { description = "Model for the Free diskspace Forecast monitor [available values: `default`, `simple` or `reactive`]" - type = "string" + type = string default = "default" } variable "disk_space_forecast_seasonal_seasonality" { description = "Seasonality for the Free diskspace Forecast monitor" - type = "string" + type = string default = "weekly" } @@ -239,31 +239,31 @@ variable "disk_space_forecast_threshold_critical" { variable "disk_inodes_enabled" { description = "Flag to enable Free disk inodes monitor" - type = "string" + type = string default = "true" } variable "disk_inodes_extra_tags" { description = "Extra tags for Free disk inodes monitor" - type = "list" + type = list(string) default = [] } variable "disk_inodes_message" { description = "Custom message for Free disk inodes monitor" - type = "string" + type = string default = "" } variable "disk_inodes_time_aggregator" { description = "Monitor aggregator for Free disk inodes [available values: min, max or avg]" - type = "string" + type = string default = "min" } variable "disk_inodes_timeframe" { description = "Monitor timeframe for Free disk inodes [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -279,30 +279,30 @@ variable "disk_inodes_threshold_critical" { variable "memory_enabled" { description = "Flag to enable Free memory monitor" - type = "string" + type = string default = "true" } variable "memory_extra_tags" { description = "Extra tags for Free memory monitor" - type = "list" + type = list(string) default = [] } variable "memory_message" { description = "Mandatory message for Free memory monitor to avoid NBH alerting by default" - type = "string" + type = string } variable "memory_time_aggregator" { description = "Monitor aggregator for Free memory [available values: min, max or avg]" - type = "string" + type = string default = "max" } variable "memory_timeframe" { description = "Monitor timeframe for Free memory [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" - type = "string" + type = string default = "last_5m" } @@ -315,3 +315,4 @@ variable "memory_threshold_critical" { description = "Free disk space critical threshold" default = 5 } + diff --git a/system/generic/modules.tf b/system/generic/modules.tf index fe7a5d1..fc2e056 100644 --- a/system/generic/modules.tf +++ b/system/generic/modules.tf @@ -1,20 +1,21 @@ module "filter-tags" { source = "../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "system" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded } module "filter-tags-disk" { source = "../../common/filter-tags" - environment = "${var.environment}" + environment = var.environment resource = "system" - filter_tags_use_defaults = "${var.filter_tags_use_defaults}" - filter_tags_custom = "${var.filter_tags_custom}" - filter_tags_custom_excluded = "${var.filter_tags_custom_excluded}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom + filter_tags_custom_excluded = var.filter_tags_custom_excluded extra_tags = ["dd_disk:enabled"] } + diff --git a/system/generic/monitors-system.tf b/system/generic/monitors-system.tf index b6dfb90..860db6e 100644 --- a/system/generic/monitors-system.tf +++ b/system/generic/monitors-system.tf @@ -1,117 +1,122 @@ resource "datadog_monitor" "cpu" { - count = "${var.cpu_enabled == "true" ? 1 : 0}" + count = var.cpu_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] CPU usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.cpu_message, var.message)}" + message = coalesce(var.cpu_message, var.message) + type = "query alert" query = < ${var.cpu_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.cpu_threshold_warning}" - critical = "${var.cpu_threshold_critical}" + thresholds = { + warning = var.cpu_threshold_warning + critical = var.cpu_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true - tags = ["env:${var.environment}", "type:system", "provider:system-check", "resource:generic", "team:claranet", "created-by:terraform", "${var.cpu_extra_tags}"] + tags = ["env:${var.environment}", "type:system", "provider:system-check", "resource:generic", "team:claranet", "created-by:terraform", var.cpu_extra_tags] } resource "datadog_monitor" "load" { - count = "${var.load_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] CPU load 5 ratio {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" - message = "${coalesce(var.load_message, var.message)}" + count = var.load_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] CPU load 5 ratio {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.load_message, var.message) + type = "query alert" query = < ${var.load_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.load_threshold_warning +critical = var.load_threshold_critical +} - thresholds { - warning = "${var.load_threshold_warning}" - critical = "${var.load_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = true - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - - tags = ["env:${var.environment}", "type:system", "provider:system-core", "resource:generic", "team:claranet", "created-by:terraform", "${var.load_extra_tags}"] +tags = ["env:${var.environment}", "type:system", "provider:system-core", "resource:generic", "team:claranet", "created-by:terraform", var.load_extra_tags] } resource "datadog_monitor" "disk_space" { - count = "${var.disk_space_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk space usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.disk_space_message, var.message)}" +count = var.disk_space_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk space usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" +message = coalesce(var.disk_space_message, var.message) +type = "query alert" - query = < ${var.disk_space_threshold_critical} - EOQ +EOQ - type = "query alert" +thresholds = { +warning = var.disk_space_threshold_warning +critical = var.disk_space_threshold_critical +} - thresholds { - warning = "${var.disk_space_threshold_warning}" - critical = "${var.disk_space_threshold_critical}" - } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false +notify_audit = false +timeout_h = 0 +include_tags = true +locked = false +require_full_window = true - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - - tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", "${var.disk_space_extra_tags}"] +tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", var.disk_space_extra_tags] } resource "datadog_monitor" "disk_space_forecast" { - count = "${var.disk_space_forecast_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk Space usage could reach {{#is_alert}}{{threshold}}%{{/is_alert}} in a near future" - message = "${coalesce(var.disk_space_forecast_message, var.message)}" +count = var.disk_space_forecast_enabled == "true" ? 1 : 0 +name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk Space usage could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" +message = coalesce(var.disk_space_forecast_message, var.message) +type = "query alert" - query = <= ${var.disk_space_forecast_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - critical_recovery = "${var.disk_space_forecast_threshold_critical_recovery}" - critical = "${var.disk_space_forecast_threshold_critical}" + thresholds = { + critical_recovery = var.disk_space_forecast_threshold_critical_recovery + critical = var.disk_space_forecast_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_audit = false locked = false timeout_h = 0 @@ -120,70 +125,66 @@ resource "datadog_monitor" "disk_space_forecast" { notify_no_data = false renotify_interval = 0 - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - - tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", "${var.disk_space_forecast_extra_tags}"] + tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", var.disk_space_forecast_extra_tags] } resource "datadog_monitor" "disk_inodes" { - count = "${var.disk_inodes_enabled == "true" ? 1 : 0}" + count = var.disk_inodes_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk inodes usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${coalesce(var.disk_inodes_message, var.message)}" + message = coalesce(var.disk_inodes_message, var.message) + type = "query alert" query = < ${var.disk_inodes_threshold_critical} - EOQ +EOQ - type = "query alert" - - thresholds { - warning = "${var.disk_inodes_threshold_warning}" - critical = "${var.disk_inodes_threshold_critical}" + thresholds = { + warning = var.disk_inodes_threshold_warning + critical = var.disk_inodes_threshold_critical } - notify_no_data = false - evaluation_delay = "${var.evaluation_delay}" - new_host_delay = "${var.new_host_delay}" - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true - tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", "${var.disk_inodes_extra_tags}"] + tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", var.disk_inodes_extra_tags] } resource "datadog_monitor" "memory" { - count = "${var.memory_enabled == "true" ? 1 : 0}" - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Usable Memory {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - message = "${var.memory_message}" + count = var.memory_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Usable Memory {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = var.memory_message + type = "query alert" query = < Date: Fri, 14 Jun 2019 12:39:34 +0200 Subject: [PATCH 02/26] MON-459 fix undesired changes --- .../ingress/vts/monitors-ingress.tf | 10 ++- caas/kubernetes/node/monitors-k8s-node.tf | 18 ++--- caas/kubernetes/pod/monitors-k8s-pod.tf | 5 +- .../workload/monitors-k8s-workload.tf | 11 +-- cloud/aws/alb/monitors-alb.tf | 4 +- cloud/aws/apigateway/monitors-api.tf | 21 +++--- .../memcached/monitors-memcached.tf | 10 ++- cloud/aws/elasticache/redis/monitors-redis.tf | 23 +++---- .../elasticsearch/monitors-elasticsearch.tf | 15 ++-- cloud/aws/elb/monitors-elb.tf | 28 ++++---- .../monitors-kinesis-firehose.tf | 4 +- .../aurora/mysql/monitors-rds-aurora-mysql.tf | 4 +- .../monitors-rds-aurora-postgresql.tf | 4 +- cloud/aws/rds/common/monitors-rds-common.tf | 14 ++-- cloud/aws/vpn/monitors-vpn.tf | 4 +- .../monitors-azure-apimanagement.tf | 24 +++---- .../app-services/monitors-app_services.tf | 6 +- cloud/azure/cosmosdb/monitors-cosmosdb.tf | 20 +++--- .../datalakestore/monitors-datalakestore.tf | 4 +- cloud/azure/eventgrid/monitors-eventgrid.tf | 14 ++-- cloud/azure/eventhub/monitors-eventhub.tf | 14 ++-- cloud/azure/functions/monitors-functions.tf | 6 +- cloud/azure/iothubs/monitors-iothubs.tf | 68 +++++++++---------- cloud/azure/keyvault/monitors-keyvault.tf | 12 ++-- .../load-balancer/monitors-load-balancer.tf | 4 +- cloud/azure/mysql/monitors-mysql.tf | 19 +++--- .../azure/postgresql/monitors-postegresql.tf | 25 ++++--- cloud/azure/redis/monitors-azure-redis.tf | 20 +++--- .../serverfarms/monitors-azure-serverfarms.tf | 12 ++-- .../azure/servicebus/monitors-service-bus.tf | 20 +++--- .../sql-database/monitors-sql-database.tf | 24 +++---- .../monitors-sql-elasticpool.tf | 14 ++-- cloud/azure/storage/monitors-azure-storage.tf | 45 ++++++------ .../monitors-stream-analytics.tf | 25 ++++--- .../monitors-virtual-machine.tf | 14 ++-- cloud/gcp/big-query/monitors-big-query.tf | 52 ++++++-------- .../common/monitors-cloud-sql-common.tf | 31 ++++----- .../mysql/monitors-cloudsql-mysql.tf | 5 +- .../gcp/gce/instance/monitors-gce-instance.tf | 19 +++--- cloud/gcp/lb/monitors-lb.tf | 29 ++++---- cloud/gcp/pubsub/monitors-pubsub.tf | 10 ++- database/mongodb/monitors-mongo.tf | 2 - database/mysql/monitors-mysql.tf | 2 +- 43 files changed, 327 insertions(+), 388 deletions(-) diff --git a/caas/kubernetes/ingress/vts/monitors-ingress.tf b/caas/kubernetes/ingress/vts/monitors-ingress.tf index b90bc00..4c5b32d 100644 --- a/caas/kubernetes/ingress/vts/monitors-ingress.tf +++ b/caas/kubernetes/ingress/vts/monitors-ingress.tf @@ -2,6 +2,7 @@ resource "datadog_monitor" "nginx_ingress_too_many_5xx" { count = var.ingress_5xx_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Nginx Ingress 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.ingress_5xx_message, var.message) + type = "query alert" query = < ${var.ingress_5xx_threshold_critical} EOQ - type = "query alert" - thresholds = { warning = var.ingress_5xx_threshold_warning critical = var.ingress_5xx_threshold_critical } - notify_no_data = false evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay + notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 @@ -34,6 +33,7 @@ resource "datadog_monitor" "nginx_ingress_too_many_4xx" { count = var.ingress_4xx_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Nginx Ingress 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.ingress_4xx_message, var.message) + type = "query alert" query = < ${var.ingress_4xx_threshold_critical} EOQ -type = "query alert" - thresholds = { warning = var.ingress_4xx_threshold_warning critical = var.ingress_4xx_threshold_critical } -notify_no_data = false evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay +notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 diff --git a/caas/kubernetes/node/monitors-k8s-node.tf b/caas/kubernetes/node/monitors-k8s-node.tf index 23e82cd..61901ed 100644 --- a/caas/kubernetes/node/monitors-k8s-node.tf +++ b/caas/kubernetes/node/monitors-k8s-node.tf @@ -2,7 +2,6 @@ resource "datadog_monitor" "disk_pressure" { count = var.disk_pressure_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node Disk pressure" message = coalesce(var.disk_pressure_message, var.message) - type = "service check" query = < ${var.unregister_net_device_threshold_critical} EOQ new_host_delay = var.new_host_delay - notify_no_data = false renotify_interval = 0 notify_audit = false @@ -191,8 +184,8 @@ tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource: resource "datadog_monitor" "node_unschedulable" { count = var.node_unschedulable_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node unschedulable" -type = "metric alert" message = coalesce(var.node_unschedulable_message, var.message) +type = "metric alert" query = < ${var.latency_threshold_critical} EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - thresholds = { warning = var.latency_threshold_warning critical = var.latency_threshold_critical } + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = false @@ -32,8 +31,8 @@ EOQ resource "datadog_monitor" "API_http_5xx_errors_count" { count = var.http_5xx_requests_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - type = "query alert" message = coalesce(var.http_5xx_requests_message, var.message) + type = "query alert" query = < ${var.http_5xx_requests_threshold_critical} EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay - thresholds = { warning = var.http_5xx_requests_threshold_warning critical = var.http_5xx_requests_threshold_critical } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = false @@ -63,8 +61,8 @@ tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigat resource "datadog_monitor" "API_http_4xx_errors_count" { count = var.http_4xx_requests_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" - type = "query alert" message = coalesce(var.http_4xx_requests_message, var.message) +type = "query alert" query = < ${var.http_4xx_requests_threshold_critical} EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay - thresholds = { warning = var.http_4xx_requests_threshold_warning critical = var.http_4xx_requests_threshold_critical } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay notify_no_data = false renotify_interval = 0 require_full_window = false diff --git a/cloud/aws/elasticache/memcached/monitors-memcached.tf b/cloud/aws/elasticache/memcached/monitors-memcached.tf index 3006253..25e3b0c 100644 --- a/cloud/aws/elasticache/memcached/monitors-memcached.tf +++ b/cloud/aws/elasticache/memcached/monitors-memcached.tf @@ -2,7 +2,6 @@ resource "datadog_monitor" "memcached_get_hits" { count = var.get_hits_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache memcached cache hit ratio {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.get_hits_message, var.message) - type = "query alert" query = < ${var.cpu_high_threshold_critical} EOQ -notify_no_data = true evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = true renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false -new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", var.cpu_high_extra_tags] } @@ -61,8 +59,7 @@ resource "datadog_monitor" "redis_replication_lag" { count = var.replication_lag_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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) - - type = "query alert" +type = "query alert" query = < 0 EOQ -notify_no_data = false evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 1 include_tags = true locked = false require_full_window = false -new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.too_many_d2c_telemetry_ingress_nosent_extra_tags] } diff --git a/cloud/azure/keyvault/monitors-keyvault.tf b/cloud/azure/keyvault/monitors-keyvault.tf index aabad04..948afbf 100644 --- a/cloud/azure/keyvault/monitors-keyvault.tf +++ b/cloud/azure/keyvault/monitors-keyvault.tf @@ -10,15 +10,15 @@ resource "datadog_monitor" "keyvault_status" { ) < 1 EOQ - notify_no_data = true evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform", var.status_extra_tags] } @@ -43,15 +43,15 @@ critical = var.api_result_threshold_critical warning = var.api_result_threshold_warning } -notify_no_data = false evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false -new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform", var.api_result_extra_tags] } @@ -73,15 +73,15 @@ critical = var.api_latency_threshold_critical warning = var.api_latency_threshold_warning } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay notify_no_data = false -evaluation_delay = var.evaluation_delay renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false -new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform", var.api_latency_extra_tags] } diff --git a/cloud/azure/load-balancer/monitors-load-balancer.tf b/cloud/azure/load-balancer/monitors-load-balancer.tf index a67ab49..730fb6b 100644 --- a/cloud/azure/load-balancer/monitors-load-balancer.tf +++ b/cloud/azure/load-balancer/monitors-load-balancer.tf @@ -10,15 +10,15 @@ resource "datadog_monitor" "loadbalancer_status" { ) < 1 EOQ - notify_no_data = true evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:load-balancer", "team:claranet", "created-by:terraform", var.status_extra_tags] } diff --git a/cloud/azure/mysql/monitors-mysql.tf b/cloud/azure/mysql/monitors-mysql.tf index 064a4ed..5c3e611 100644 --- a/cloud/azure/mysql/monitors-mysql.tf +++ b/cloud/azure/mysql/monitors-mysql.tf @@ -15,15 +15,15 @@ EOQ warning = var.cpu_usage_threshold_warning } - notify_no_data = false evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false - new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.cpu_usage_extra_tags] } @@ -38,7 +38,6 @@ resource "datadog_monitor" "mysql_free_storage" { ${var.free_storage_time_aggregator}(${var.free_storage_timeframe}): ( 100 - avg:azure.dbformysql_servers.storage_percent${module.filter-tags.query_alert} by {resource_group,region,name} ) < ${var.free_storage_threshold_critical} - EOQ thresholds = { @@ -46,15 +45,15 @@ critical = var.free_storage_threshold_critical warning = var.free_storage_threshold_warning } -notify_no_data = false evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false -new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.free_storage_extra_tags] } @@ -76,15 +75,15 @@ critical = var.io_consumption_threshold_critical warning = var.io_consumption_threshold_warning } -notify_no_data = false evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false -new_host_delay = var.new_host_delay tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.io_consumption_extra_tags] } @@ -93,7 +92,7 @@ resource "datadog_monitor" "mysql_memory_usage" { count = var.memory_usage_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.memory_usage_message, var.message) - type = "query alert" +type = "query alert" query = < ${var.su_utilization_threshold_critical} EOQ -notify_no_data = false evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay +notify_no_data = false renotify_interval = 0 notify_audit = false timeout_h = 0 include_tags = true locked = false require_full_window = false -new_host_delay = var.new_host_delay thresholds = { warning = var.su_utilization_threshold_warning @@ -57,7 +57,7 @@ resource "datadog_monitor" "failed_function_requests" { count = var.failed_function_requests_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.failed_function_requests_message, var.message) - type = "query alert" +type = "query alert" query = < ${var.stored_bytes_threshold_critical} EOQ - thresholds = { warning = var.stored_bytes_threshold_warning critical = var.stored_bytes_threshold_critical } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay include_tags = true notify_no_data = false require_full_window = false @@ -197,9 +193,6 @@ notify_audit = false timeout_h = 0 locked = false -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.stored_bytes_extra_tags] } @@ -223,6 +216,8 @@ warning = var.table_count_threshold_warning critical = var.table_count_threshold_critical } +evaluation_delay = var.evaluation_delay +new_host_delay = var.new_host_delay include_tags = true notify_no_data = false require_full_window = false @@ -231,9 +226,6 @@ notify_audit = false timeout_h = 0 locked = false -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.table_count_extra_tags] } @@ -244,7 +236,7 @@ resource "datadog_monitor" "uploaded_bytes" { count = var.uploaded_bytes_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Uploaded Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" message = coalesce(var.uploaded_bytes_message, var.message) - type = "query alert" +type = "query alert" query = <= 2 EOQ - evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = true @@ -61,7 +60,6 @@ query = < 99 - EOQ thresholds = { diff --git a/database/mysql/monitors-mysql.tf b/database/mysql/monitors-mysql.tf index 31511fe..7feeffe 100644 --- a/database/mysql/monitors-mysql.tf +++ b/database/mysql/monitors-mysql.tf @@ -13,9 +13,9 @@ EOQ critical = 5 } - notify_no_data = true no_data_timeframe = var.mysql_availability_no_data_timeframe new_host_delay = var.new_host_delay + notify_no_data = true renotify_interval = 0 notify_audit = false timeout_h = 0 From a06b680f6d31294b562d03e45b78649f9cabbfc9 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 12:12:27 +0200 Subject: [PATCH 03/26] MON-459 use concat for extra tags --- caas/kubernetes/ark/monitors-ark.tf | 2 +- .../cluster/monitors-k8s-cluster.tf | 2 +- .../ingress/vts/monitors-ingress.tf | 4 +-- caas/kubernetes/node/monitors-k8s-node.tf | 20 ++++++------- caas/kubernetes/pod/monitors-k8s-pod.tf | 4 +-- .../workload/monitors-k8s-workload.tf | 10 +++---- cloud/aws/alb/monitors-alb.tf | 13 +++++---- cloud/aws/apigateway/monitors-api.tf | 6 ++-- .../common/monitors-elasticache.tf | 12 ++++---- .../memcached/monitors-memcached.tf | 4 +-- cloud/aws/elasticache/redis/monitors-redis.tf | 8 +++--- .../elasticsearch/monitors-elasticsearch.tf | 6 ++-- cloud/aws/elb/monitors-elb.tf | 12 ++++---- .../monitors-kinesis-firehose.tf | 2 +- .../aurora/mysql/monitors-rds-aurora-mysql.tf | 2 +- .../monitors-rds-aurora-postgresql.tf | 2 +- cloud/aws/rds/common/monitors-rds-common.tf | 6 ++-- cloud/aws/vpn/monitors-vpn.tf | 2 +- .../monitors-azure-apimanagement.tf | 10 +++---- .../app-services/monitors-app_services.tf | 12 ++++---- .../azure-search/monitors-azure-search.tf | 4 +-- cloud/azure/cosmosdb/monitors-cosmosdb.tf | 8 +++--- .../datalakestore/monitors-datalakestore.tf | 2 +- cloud/azure/eventgrid/monitors-eventgrid.tf | 6 ++-- cloud/azure/eventhub/monitors-eventhub.tf | 6 ++-- cloud/azure/functions/monitors-functions.tf | 6 ++-- cloud/azure/iothubs/monitors-iothubs.tf | 28 +++++++++---------- cloud/azure/keyvault/monitors-keyvault.tf | 6 ++-- .../load-balancer/monitors-load-balancer.tf | 2 +- cloud/azure/mysql/monitors-mysql.tf | 8 +++--- .../azure/postgresql/monitors-postegresql.tf | 10 +++---- cloud/azure/redis/monitors-azure-redis.tf | 8 +++--- .../serverfarms/monitors-azure-serverfarms.tf | 6 ++-- .../azure/servicebus/monitors-service-bus.tf | 8 +++--- .../sql-database/monitors-sql-database.tf | 10 +++---- .../monitors-sql-elasticpool.tf | 6 ++-- cloud/azure/storage/monitors-azure-storage.tf | 18 ++++++------ .../monitors-stream-analytics.tf | 10 +++---- .../monitors-virtual-machine.tf | 6 ++-- cloud/gcp/big-query/monitors-big-query.tf | 18 ++++++------ .../common/monitors-cloud-sql-common.tf | 21 ++++++++++---- .../mysql/monitors-cloudsql-mysql.tf | 2 +- .../gcp/gce/instance/monitors-gce-instance.tf | 6 ++-- cloud/gcp/lb/monitors-lb.tf | 10 +++---- cloud/gcp/pubsub/monitors-pubsub.tf | 4 +-- database/mongodb/monitors-mongo.tf | 8 +++--- database/mysql/monitors-mysql.tf | 16 +++++------ database/postgresql/monitors-postgresql.tf | 6 ++-- database/redis/monitors-redis.tf | 20 ++++++------- middleware/apache/monitors-apache.tf | 2 +- middleware/nginx/monitors-nginx.tf | 4 +-- middleware/php-fpm/monitors-fpm.tf | 4 +-- system/generic/monitors-system.tf | 12 ++++---- system/unreachable/monitors-unreachable.tf | 2 +- 54 files changed, 221 insertions(+), 211 deletions(-) diff --git a/caas/kubernetes/ark/monitors-ark.tf b/caas/kubernetes/ark/monitors-ark.tf index 60306af..94039ab 100644 --- a/caas/kubernetes/ark/monitors-ark.tf +++ b/caas/kubernetes/ark/monitors-ark.tf @@ -25,6 +25,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:caas", "provider:prometheus", "resource:ark", "team:claranet", "created-by:terraform", var.ark_schedules_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:ark", "team:claranet", "created-by:terraform"], var.ark_schedules_extra_tags) } diff --git a/caas/kubernetes/cluster/monitors-k8s-cluster.tf b/caas/kubernetes/cluster/monitors-k8s-cluster.tf index 8a1e0a1..f5a8fbc 100644 --- a/caas/kubernetes/cluster/monitors-k8s-cluster.tf +++ b/caas/kubernetes/cluster/monitors-k8s-cluster.tf @@ -23,6 +23,6 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.apiserver_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.apiserver_extra_tags) } diff --git a/caas/kubernetes/ingress/vts/monitors-ingress.tf b/caas/kubernetes/ingress/vts/monitors-ingress.tf index 4c5b32d..d665ad7 100644 --- a/caas/kubernetes/ingress/vts/monitors-ingress.tf +++ b/caas/kubernetes/ingress/vts/monitors-ingress.tf @@ -26,7 +26,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform", var.ingress_5xx_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_5xx_extra_tags) } resource "datadog_monitor" "nginx_ingress_too_many_4xx" { @@ -57,6 +57,6 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform", var.ingress_4xx_extra_tags] +tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_4xx_extra_tags) } diff --git a/caas/kubernetes/node/monitors-k8s-node.tf b/caas/kubernetes/node/monitors-k8s-node.tf index 61901ed..e243868 100644 --- a/caas/kubernetes/node/monitors-k8s-node.tf +++ b/caas/kubernetes/node/monitors-k8s-node.tf @@ -22,7 +22,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.disk_pressure_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.disk_pressure_extra_tags) } resource "datadog_monitor" "disk_out" { @@ -49,7 +49,7 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.disk_out_extra_tags] +tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.disk_out_extra_tags) } resource "datadog_monitor" "memory_pressure" { @@ -76,7 +76,7 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.memory_pressure_extra_tags] +tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.memory_pressure_extra_tags) } resource "datadog_monitor" "ready" { @@ -103,7 +103,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.ready_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.ready_extra_tags) } resource "datadog_monitor" "kubelet_ping" { @@ -130,7 +130,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.kubelet_ping_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.kubelet_ping_extra_tags) } resource "datadog_monitor" "kubelet_syncloop" { @@ -157,7 +157,7 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.kubelet_syncloop_extra_tags] +tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.kubelet_syncloop_extra_tags) } resource "datadog_monitor" "unregister_net_device" { @@ -178,7 +178,7 @@ timeout_h = 0 include_tags = true locked = false -tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.unregister_net_device_extra_tags] +tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.unregister_net_device_extra_tags) } resource "datadog_monitor" "node_unschedulable" { @@ -207,7 +207,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.node_unschedulable_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.node_unschedulable_extra_tags) } resource "datadog_monitor" "volume_space" { @@ -238,7 +238,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.volume_space_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.volume_space_extra_tags) } resource "datadog_monitor" "volume_inodes" { @@ -269,6 +269,6 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform", var.volume_inodes_extra_tags] +tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.volume_inodes_extra_tags) } diff --git a/caas/kubernetes/pod/monitors-k8s-pod.tf b/caas/kubernetes/pod/monitors-k8s-pod.tf index b5f2d78..d6c3c49 100644 --- a/caas/kubernetes/pod/monitors-k8s-pod.tf +++ b/caas/kubernetes/pod/monitors-k8s-pod.tf @@ -24,7 +24,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform", var.pod_phase_status_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform"], var.pod_phase_status_extra_tags) } resource "datadog_monitor" "error" { @@ -54,6 +54,6 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform", var.error_extra_tags] +tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform"], var.error_extra_tags) } diff --git a/caas/kubernetes/workload/monitors-k8s-workload.tf b/caas/kubernetes/workload/monitors-k8s-workload.tf index 2c25bae..1da8939 100644 --- a/caas/kubernetes/workload/monitors-k8s-workload.tf +++ b/caas/kubernetes/workload/monitors-k8s-workload.tf @@ -22,7 +22,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform", var.job_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform"], var.job_extra_tags) } resource "datadog_monitor" "cronjob" { @@ -49,7 +49,7 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform", var.cronjob_extra_tags] +tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform"], var.cronjob_extra_tags) } resource "datadog_monitor" "replica_available" { @@ -79,7 +79,7 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform", var.replica_available_extra_tags] +tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform"], var.replica_available_extra_tags) } resource "datadog_monitor" "replica_ready" { @@ -109,7 +109,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform", var.replica_ready_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform"], var.replica_ready_extra_tags) } resource "datadog_monitor" "replica_current" { @@ -139,6 +139,6 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform", var.replica_current_extra_tags] + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform"], var.replica_current_extra_tags) } diff --git a/cloud/aws/alb/monitors-alb.tf b/cloud/aws/alb/monitors-alb.tf index 01ae38d..cf98d7c 100644 --- a/cloud/aws/alb/monitors-alb.tf +++ b/cloud/aws/alb/monitors-alb.tf @@ -25,7 +25,7 @@ EOQ timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.alb_no_healthy_instances_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.alb_no_healthy_instances_extra_tags) } resource "datadog_monitor" "ALB_latency" { @@ -53,7 +53,7 @@ require_full_window = false timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.latency_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } resource "datadog_monitor" "ALB_httpcode_5xx" { @@ -82,7 +82,7 @@ require_full_window = false timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.httpcode_alb_5xx_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_alb_5xx_extra_tags) } resource "datadog_monitor" "ALB_httpcode_4xx" { @@ -111,7 +111,7 @@ EOQ timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.httpcode_alb_4xx_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_alb_4xx_extra_tags) } resource "datadog_monitor" "ALB_httpcode_target_5xx" { @@ -139,7 +139,8 @@ EOQ require_full_window = false timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.httpcode_target_5xx_extra_tags] + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_target_5xx_extra_tags) } resource "datadog_monitor" "ALB_httpcode_target_4xx" { @@ -168,6 +169,6 @@ require_full_window = false timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform", var.httpcode_target_4xx_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_target_4xx_extra_tags) } diff --git a/cloud/aws/apigateway/monitors-api.tf b/cloud/aws/apigateway/monitors-api.tf index 9f91b81..a08f86f 100644 --- a/cloud/aws/apigateway/monitors-api.tf +++ b/cloud/aws/apigateway/monitors-api.tf @@ -24,7 +24,7 @@ EOQ timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform", var.latency_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } # Monitoring API Gateway 5xx errors percent @@ -54,7 +54,7 @@ require_full_window = false timeout_h = 1 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform", var.http_5xx_requests_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) } # Monitoring API Gateway 4xx errors percent @@ -84,6 +84,6 @@ require_full_window = false timeout_h = 1 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform", var.http_4xx_requests_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_4xx_requests_extra_tags) } diff --git a/cloud/aws/elasticache/common/monitors-elasticache.tf b/cloud/aws/elasticache/common/monitors-elasticache.tf index 284dc44..4e1837c 100644 --- a/cloud/aws/elasticache/common/monitors-elasticache.tf +++ b/cloud/aws/elasticache/common/monitors-elasticache.tf @@ -25,7 +25,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", var.eviction_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.eviction_extra_tags) } resource "datadog_monitor" "elasticache_max_connection" { @@ -50,7 +50,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", var.max_connection_extra_tags] +tags = concat(["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" { @@ -75,7 +75,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", var.no_connection_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.no_connection_extra_tags) } resource "datadog_monitor" "elasticache_swap" { @@ -105,7 +105,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", var.swap_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.swap_extra_tags) } resource "datadog_monitor" "elasticache_free_memory" { @@ -135,7 +135,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", var.free_memory_extra_tags] + tags = concat(["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" { @@ -165,6 +165,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform", var.eviction_growing_extra_tags] +tags = concat(["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/monitors-memcached.tf b/cloud/aws/elasticache/memcached/monitors-memcached.tf index 25e3b0c..c21eaf5 100644 --- a/cloud/aws/elasticache/memcached/monitors-memcached.tf +++ b/cloud/aws/elasticache/memcached/monitors-memcached.tf @@ -27,7 +27,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached", var.get_hits_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached"], var.get_hits_extra_tags) } resource "datadog_monitor" "memcached_cpu_high" { @@ -57,6 +57,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached", var.cpu_high_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached"], var.cpu_high_extra_tags) } diff --git a/cloud/aws/elasticache/redis/monitors-redis.tf b/cloud/aws/elasticache/redis/monitors-redis.tf index ae76a0d..6880aa9 100644 --- a/cloud/aws/elasticache/redis/monitors-redis.tf +++ b/cloud/aws/elasticache/redis/monitors-redis.tf @@ -27,7 +27,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", var.cache_hits_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.cache_hits_extra_tags) } resource "datadog_monitor" "redis_cpu_high" { @@ -52,7 +52,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", var.cpu_high_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.cpu_high_extra_tags) } resource "datadog_monitor" "redis_replication_lag" { @@ -82,7 +82,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", var.replication_lag_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.replication_lag_extra_tags) } resource "datadog_monitor" "redis_commands" { @@ -109,6 +109,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis", var.commands_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.commands_extra_tags) } diff --git a/cloud/aws/elasticsearch/monitors-elasticsearch.tf b/cloud/aws/elasticsearch/monitors-elasticsearch.tf index 66a10c4..9568f8e 100644 --- a/cloud/aws/elasticsearch/monitors-elasticsearch.tf +++ b/cloud/aws/elasticsearch/monitors-elasticsearch.tf @@ -31,7 +31,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform", var.es_cluster_status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.es_cluster_status_extra_tags) } ### Elasticsearch cluster free storage space monitor ### @@ -63,7 +63,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform", var.diskspace_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) } ### Elasticsearch cluster CPU monitor ### @@ -94,6 +94,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform", var.cpu_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } diff --git a/cloud/aws/elb/monitors-elb.tf b/cloud/aws/elb/monitors-elb.tf index 0214167..0f3bbc3 100644 --- a/cloud/aws/elb/monitors-elb.tf +++ b/cloud/aws/elb/monitors-elb.tf @@ -27,7 +27,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_no_healthy_instance_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_no_healthy_instance_extra_tags) } resource "datadog_monitor" "ELB_too_much_4xx" { @@ -58,7 +58,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_4xx_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_4xx_extra_tags) } resource "datadog_monitor" "ELB_too_much_5xx" { @@ -89,7 +89,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_5xx_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_5xx_extra_tags) } resource "datadog_monitor" "ELB_too_much_4xx_backend" { @@ -120,7 +120,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_backend_4xx_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_backend_4xx_extra_tags) } resource "datadog_monitor" "ELB_too_much_5xx_backend" { @@ -151,7 +151,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_backend_5xx_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_backend_5xx_extra_tags) } resource "datadog_monitor" "ELB_backend_latency" { @@ -181,6 +181,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform", var.elb_backend_latency_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_backend_latency_extra_tags) } diff --git a/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf b/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf index 1a299b4..6cd533a 100644 --- a/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf +++ b/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf @@ -25,6 +25,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:kinesis-firehose", "team:claranet", "created-by:terraform", var.incoming_records_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:kinesis-firehose", "team:claranet", "created-by:terraform"], var.incoming_records_extra_tags) } diff --git a/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf b/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf index bec001d..486c68e 100644 --- a/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf +++ b/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf @@ -25,6 +25,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-mysql", "team:claranet", "created-by:terraform", var.aurora_replicalag_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-mysql", "team:claranet", "created-by:terraform"], var.aurora_replicalag_extra_tags) } diff --git a/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf b/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf index b52fcb6..49620fb 100644 --- a/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf +++ b/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf @@ -25,6 +25,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-postgresql", "team:claranet", "created-by:terraform", var.aurora_replicalag_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-postgresql", "team:claranet", "created-by:terraform"], var.aurora_replicalag_extra_tags) } diff --git a/cloud/aws/rds/common/monitors-rds-common.tf b/cloud/aws/rds/common/monitors-rds-common.tf index b0db80f..dd75d71 100644 --- a/cloud/aws/rds/common/monitors-rds-common.tf +++ b/cloud/aws/rds/common/monitors-rds-common.tf @@ -25,7 +25,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", var.cpu_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } ### RDS instance free space monitor ### @@ -56,7 +56,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", var.diskspace_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) } ### RDS Replica Lag monitor ### @@ -86,6 +86,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform", var.replicalag_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform"], var.replicalag_extra_tags) } diff --git a/cloud/aws/vpn/monitors-vpn.tf b/cloud/aws/vpn/monitors-vpn.tf index cc0f7b2..aac92dc 100644 --- a/cloud/aws/vpn/monitors-vpn.tf +++ b/cloud/aws/vpn/monitors-vpn.tf @@ -19,6 +19,6 @@ EOQ include_tags = true require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:aws", "resource:vpn", "team:claranet", "created-by:terraform", var.vpn_status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:vpn", "team:claranet", "created-by:terraform"], var.vpn_status_extra_tags) } diff --git a/cloud/azure/apimanagement/monitors-azure-apimanagement.tf b/cloud/azure/apimanagement/monitors-azure-apimanagement.tf index 11b3ad3..7d9410f 100644 --- a/cloud/azure/apimanagement/monitors-azure-apimanagement.tf +++ b/cloud/azure/apimanagement/monitors-azure-apimanagement.tf @@ -22,7 +22,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "apimgt_failed_requests" { @@ -53,7 +53,7 @@ locked = false require_full_window = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", var.failed_requests_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.failed_requests_extra_tags) } resource "datadog_monitor" "apimgt_other_requests" { @@ -84,7 +84,7 @@ locked = false require_full_window = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", var.other_requests_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.other_requests_extra_tags) } resource "datadog_monitor" "apimgt_unauthorized_requests" { @@ -115,7 +115,7 @@ EOQ require_full_window = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", var.unauthorized_requests_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.unauthorized_requests_extra_tags) } resource "datadog_monitor" "apimgt_successful_requests" { @@ -148,6 +148,6 @@ EOQ require_full_window = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform", var.successful_requests_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.successful_requests_extra_tags) } diff --git a/cloud/azure/app-services/monitors-app_services.tf b/cloud/azure/app-services/monitors-app_services.tf index fbf4f3b..93d2add 100644 --- a/cloud/azure/app-services/monitors-app_services.tf +++ b/cloud/azure/app-services/monitors-app_services.tf @@ -24,7 +24,7 @@ EOQ timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.response_time_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.response_time_extra_tags) } # Monitoring App Services memory usage @@ -53,7 +53,7 @@ require_full_window = false timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.memory_usage_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.memory_usage_extra_tags) } # Monitoring App Services 5xx errors percent @@ -83,7 +83,7 @@ require_full_window = false timeout_h = 1 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.http_5xx_requests_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) } # Monitoring App Services 4xx errors percent @@ -113,7 +113,7 @@ EOQ timeout_h = 1 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.http_4xx_requests_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.http_4xx_requests_extra_tags) } # Monitoring App Services HTTP 2xx & 3xx status pages percent @@ -145,7 +145,7 @@ EOQ timeout_h = 1 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.http_successful_requests_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.http_successful_requests_extra_tags) } # Monitoring App Services status @@ -170,6 +170,6 @@ renotify_interval = 0 require_full_window = false timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform", var.status_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.status_extra_tags) } diff --git a/cloud/azure/azure-search/monitors-azure-search.tf b/cloud/azure/azure-search/monitors-azure-search.tf index c96d786..bbac21e 100644 --- a/cloud/azure/azure-search/monitors-azure-search.tf +++ b/cloud/azure/azure-search/monitors-azure-search.tf @@ -24,7 +24,7 @@ EOQ timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform", var.latency_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } # Monitoring Azure Search throttled queries @@ -53,6 +53,6 @@ require_full_window = false timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform", var.throttled_queries_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform"], var.throttled_queries_rate_extra_tags) } diff --git a/cloud/azure/cosmosdb/monitors-cosmosdb.tf b/cloud/azure/cosmosdb/monitors-cosmosdb.tf index 08aca33..87331b9 100644 --- a/cloud/azure/cosmosdb/monitors-cosmosdb.tf +++ b/cloud/azure/cosmosdb/monitors-cosmosdb.tf @@ -24,7 +24,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "cosmos_db_4xx_requests" { @@ -65,7 +65,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", var.cosmos_db_4xx_request_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_4xx_request_extra_tags) } resource "datadog_monitor" "cosmos_db_5xx_requests" { @@ -97,7 +97,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", var.cosmos_db_5xx_request_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_5xx_request_rate_extra_tags) } resource "datadog_monitor" "cosmos_db_scaling" { @@ -129,6 +129,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform", var.cosmos_db_scaling_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_scaling_extra_tags) } diff --git a/cloud/azure/datalakestore/monitors-datalakestore.tf b/cloud/azure/datalakestore/monitors-datalakestore.tf index 5263033..895c392 100644 --- a/cloud/azure/datalakestore/monitors-datalakestore.tf +++ b/cloud/azure/datalakestore/monitors-datalakestore.tf @@ -20,6 +20,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:datalakestore", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:datalakestore", "team:claranet", "created-by:terraform"], var.status_extra_tags) } diff --git a/cloud/azure/eventgrid/monitors-eventgrid.tf b/cloud/azure/eventgrid/monitors-eventgrid.tf index 8989526..0d00c05 100644 --- a/cloud/azure/eventgrid/monitors-eventgrid.tf +++ b/cloud/azure/eventgrid/monitors-eventgrid.tf @@ -20,7 +20,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform", var.no_successful_message_rate_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.no_successful_message_rate_extra_tags) } resource "datadog_monitor" "eventgrid_failed_messages" { @@ -54,7 +54,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform", var.failed_messages_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.failed_messages_rate_extra_tags) } resource "datadog_monitor" "eventgrid_unmatched_events" { @@ -88,6 +88,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform", var.unmatched_events_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.unmatched_events_rate_extra_tags) } diff --git a/cloud/azure/eventhub/monitors-eventhub.tf b/cloud/azure/eventhub/monitors-eventhub.tf index 7cc5ded..3f6824a 100644 --- a/cloud/azure/eventhub/monitors-eventhub.tf +++ b/cloud/azure/eventhub/monitors-eventhub.tf @@ -20,7 +20,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "eventhub_failed_requests" { @@ -51,7 +51,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform", var.failed_requests_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.failed_requests_rate_extra_tags) } resource "datadog_monitor" "eventhub_errors" { @@ -84,6 +84,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform", var.errors_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.errors_rate_extra_tags) } diff --git a/cloud/azure/functions/monitors-functions.tf b/cloud/azure/functions/monitors-functions.tf index d55680c..bddc365 100644 --- a/cloud/azure/functions/monitors-functions.tf +++ b/cloud/azure/functions/monitors-functions.tf @@ -24,7 +24,7 @@ EOQ timeout_h = 1 include_tags = true - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform", var.http_5xx_errors_rate_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.http_5xx_errors_rate_extra_tags) } resource "datadog_monitor" "function_high_connections_count" { @@ -52,7 +52,7 @@ require_full_window = false timeout_h = 1 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform", var.high_connections_count_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_connections_count_extra_tags) } resource "datadog_monitor" "function_high_threads_count" { @@ -80,6 +80,6 @@ require_full_window = false timeout_h = 1 include_tags = true -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform", var.high_threads_count_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_threads_count_extra_tags) } diff --git a/cloud/azure/iothubs/monitors-iothubs.tf b/cloud/azure/iothubs/monitors-iothubs.tf index c711e71..f7db919 100644 --- a/cloud/azure/iothubs/monitors-iothubs.tf +++ b/cloud/azure/iothubs/monitors-iothubs.tf @@ -28,7 +28,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_jobs_rate_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_jobs_rate_extra_tags) } resource "datadog_monitor" "too_many_list_jobs_failed" { @@ -61,7 +61,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_listjobs_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_listjobs_rate_extra_tags) } resource "datadog_monitor" "too_many_query_jobs_failed" { @@ -94,7 +94,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_queryjobs_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_queryjobs_rate_extra_tags) } resource "datadog_monitor" "status" { @@ -119,7 +119,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "total_devices" { @@ -144,7 +144,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.total_devices_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.total_devices_extra_tags) } resource "datadog_monitor" "too_many_c2d_methods_failed" { @@ -177,7 +177,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_c2d_methods_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_methods_rate_extra_tags) } resource "datadog_monitor" "too_many_c2d_twin_read_failed" { @@ -210,7 +210,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_c2d_twin_read_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_twin_read_rate_extra_tags) } resource "datadog_monitor" "too_many_c2d_twin_update_failed" { @@ -243,7 +243,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_c2d_twin_update_rate_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_twin_update_rate_extra_tags) } resource "datadog_monitor" "too_many_d2c_twin_read_failed" { @@ -276,7 +276,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_d2c_twin_read_rate_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_d2c_twin_read_rate_extra_tags) } resource "datadog_monitor" "too_many_d2c_twin_update_failed" { @@ -309,7 +309,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.failed_d2c_twin_update_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_d2c_twin_update_rate_extra_tags) } resource "datadog_monitor" "too_many_d2c_telemetry_egress_dropped" { @@ -344,7 +344,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.dropped_d2c_telemetry_egress_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.dropped_d2c_telemetry_egress_extra_tags) } resource "datadog_monitor" "too_many_d2c_telemetry_egress_orphaned" { @@ -379,7 +379,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.orphaned_d2c_telemetry_egress_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.orphaned_d2c_telemetry_egress_extra_tags) } resource "datadog_monitor" "too_many_d2c_telemetry_egress_invalid" { @@ -414,7 +414,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.invalid_d2c_telemetry_egress_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.invalid_d2c_telemetry_egress_extra_tags) } resource "datadog_monitor" "too_many_d2c_telemetry_ingress_nosent" { @@ -441,6 +441,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform", var.too_many_d2c_telemetry_ingress_nosent_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.too_many_d2c_telemetry_ingress_nosent_extra_tags) } diff --git a/cloud/azure/keyvault/monitors-keyvault.tf b/cloud/azure/keyvault/monitors-keyvault.tf index 948afbf..3157fa6 100644 --- a/cloud/azure/keyvault/monitors-keyvault.tf +++ b/cloud/azure/keyvault/monitors-keyvault.tf @@ -20,7 +20,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "keyvault_api_result" { @@ -53,7 +53,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform", var.api_result_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform"], var.api_result_extra_tags) } resource "datadog_monitor" "keyvault_api_latency" { @@ -83,6 +83,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform", var.api_latency_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform"], var.api_latency_extra_tags) } diff --git a/cloud/azure/load-balancer/monitors-load-balancer.tf b/cloud/azure/load-balancer/monitors-load-balancer.tf index 730fb6b..7b9bd68 100644 --- a/cloud/azure/load-balancer/monitors-load-balancer.tf +++ b/cloud/azure/load-balancer/monitors-load-balancer.tf @@ -20,6 +20,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:load-balancer", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:load-balancer", "team:claranet", "created-by:terraform"], var.status_extra_tags) } diff --git a/cloud/azure/mysql/monitors-mysql.tf b/cloud/azure/mysql/monitors-mysql.tf index 5c3e611..96f9924 100644 --- a/cloud/azure/mysql/monitors-mysql.tf +++ b/cloud/azure/mysql/monitors-mysql.tf @@ -25,7 +25,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.cpu_usage_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.cpu_usage_extra_tags) } resource "datadog_monitor" "mysql_free_storage" { @@ -55,7 +55,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.free_storage_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.free_storage_extra_tags) } resource "datadog_monitor" "mysql_io_consumption" { @@ -85,7 +85,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.io_consumption_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.io_consumption_extra_tags) } resource "datadog_monitor" "mysql_memory_usage" { @@ -115,6 +115,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform", var.memory_usage_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.memory_usage_extra_tags) } diff --git a/cloud/azure/postgresql/monitors-postegresql.tf b/cloud/azure/postgresql/monitors-postegresql.tf index 2ea81c9..a8eea9f 100644 --- a/cloud/azure/postgresql/monitors-postegresql.tf +++ b/cloud/azure/postgresql/monitors-postegresql.tf @@ -25,7 +25,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", var.cpu_usage_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform"], var.cpu_usage_extra_tags) } resource "datadog_monitor" "postgresql_no_connection" { @@ -50,7 +50,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", var.no_connection_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform"], var.no_connection_extra_tags) } resource "datadog_monitor" "postgresql_free_storage" { @@ -80,7 +80,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", var.free_storage_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform"], var.free_storage_extra_tags) } resource "datadog_monitor" "postgresql_io_consumption" { @@ -110,7 +110,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", var.io_consumption_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform"], var.io_consumption_extra_tags) } resource "datadog_monitor" "postgresql_memory_usage" { @@ -140,6 +140,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform", var.memory_usage_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:postgresql", "team:claranet", "created-by:terraform"], var.memory_usage_extra_tags) } diff --git a/cloud/azure/redis/monitors-azure-redis.tf b/cloud/azure/redis/monitors-azure-redis.tf index 781273e..4e5399f 100644 --- a/cloud/azure/redis/monitors-azure-redis.tf +++ b/cloud/azure/redis/monitors-azure-redis.tf @@ -20,7 +20,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "evictedkeys" { @@ -50,7 +50,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", var.evictedkeys_limit_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_limit_extra_tags) } resource "datadog_monitor" "percent_processor_time" { @@ -80,7 +80,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", var.percent_processor_time_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.percent_processor_time_extra_tags) } resource "datadog_monitor" "server_load" { @@ -110,6 +110,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform", var.server_load_rate_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.server_load_rate_extra_tags) } diff --git a/cloud/azure/serverfarms/monitors-azure-serverfarms.tf b/cloud/azure/serverfarms/monitors-azure-serverfarms.tf index 6e719c2..9b1b81a 100644 --- a/cloud/azure/serverfarms/monitors-azure-serverfarms.tf +++ b/cloud/azure/serverfarms/monitors-azure-serverfarms.tf @@ -20,7 +20,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "cpu_percentage" { @@ -50,7 +50,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform", var.cpu_percentage_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.cpu_percentage_extra_tags) } resource "datadog_monitor" "memory_percentage" { @@ -80,6 +80,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform", var.memory_percentage_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.memory_percentage_extra_tags) } diff --git a/cloud/azure/servicebus/monitors-service-bus.tf b/cloud/azure/servicebus/monitors-service-bus.tf index bccc402..3db613b 100644 --- a/cloud/azure/servicebus/monitors-service-bus.tf +++ b/cloud/azure/servicebus/monitors-service-bus.tf @@ -20,7 +20,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "service_bus_no_active_connections" { @@ -45,7 +45,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] +tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] } resource "datadog_monitor" "service_bus_user_errors" { @@ -76,7 +76,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] +tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] } resource "datadog_monitor" "service_bus_server_errors" { @@ -107,6 +107,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] + tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] } diff --git a/cloud/azure/sql-database/monitors-sql-database.tf b/cloud/azure/sql-database/monitors-sql-database.tf index 4d7da57..063154c 100644 --- a/cloud/azure/sql-database/monitors-sql-database.tf +++ b/cloud/azure/sql-database/monitors-sql-database.tf @@ -20,7 +20,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "sql-database_cpu" { @@ -50,7 +50,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", var.cpu_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } resource "datadog_monitor" "sql-database_free_space_low" { @@ -80,7 +80,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", var.diskspace_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) } resource "datadog_monitor" "sql-database_dtu_consumption_high" { @@ -110,7 +110,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", var.dtu_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.dtu_extra_tags) } resource "datadog_monitor" "sql-database_deadlocks_count" { @@ -139,6 +139,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform", var.deadlock_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.deadlock_extra_tags) } diff --git a/cloud/azure/sql-elasticpool/monitors-sql-elasticpool.tf b/cloud/azure/sql-elasticpool/monitors-sql-elasticpool.tf index bdc7a54..eaed676 100644 --- a/cloud/azure/sql-elasticpool/monitors-sql-elasticpool.tf +++ b/cloud/azure/sql-elasticpool/monitors-sql-elasticpool.tf @@ -25,7 +25,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform", var.cpu_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } resource "datadog_monitor" "sql_elasticpool_free_space_low" { @@ -55,7 +55,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform", var.diskspace_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) } resource "datadog_monitor" "sql_elasticpool_dtu_consumption_high" { @@ -85,6 +85,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform", var.dtu_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.dtu_extra_tags) } diff --git a/cloud/azure/storage/monitors-azure-storage.tf b/cloud/azure/storage/monitors-azure-storage.tf index 5a003e7..5c9d1bc 100644 --- a/cloud/azure/storage/monitors-azure-storage.tf +++ b/cloud/azure/storage/monitors-azure-storage.tf @@ -25,7 +25,7 @@ EOQ require_full_window = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.availability_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.availability_extra_tags) } resource "datadog_monitor" "successful_requests" { @@ -55,7 +55,7 @@ locked = false require_full_window = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.successful_requests_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.successful_requests_extra_tags) } resource "datadog_monitor" "latency" { @@ -85,7 +85,7 @@ locked = false require_full_window = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.latency_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } resource "datadog_monitor" "timeout_error_requests" { @@ -115,7 +115,7 @@ EOQ require_full_window = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.timeout_error_requests_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.timeout_error_requests_extra_tags) } resource "datadog_monitor" "network_error_requests" { @@ -145,7 +145,7 @@ EOQ require_full_window = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.network_error_requests_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.network_error_requests_extra_tags) } resource "datadog_monitor" "throttling_error_requests" { @@ -175,7 +175,7 @@ locked = false require_full_window = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.throttling_error_requests_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.throttling_error_requests_extra_tags) } resource "datadog_monitor" "server_other_error_requests" { @@ -205,7 +205,7 @@ locked = false require_full_window = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.server_other_error_requests_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.server_other_error_requests_extra_tags) } resource "datadog_monitor" "client_other_error_requests" { @@ -235,7 +235,7 @@ EOQ require_full_window = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.client_other_error_requests_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.client_other_error_requests_extra_tags) } resource "datadog_monitor" "authorization_error_requests" { @@ -265,6 +265,6 @@ EOQ require_full_window = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform", var.authorization_error_requests_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.authorization_error_requests_extra_tags) } diff --git a/cloud/azure/stream-analytics/monitors-stream-analytics.tf b/cloud/azure/stream-analytics/monitors-stream-analytics.tf index 8e3a1cb..9c3d1bb 100644 --- a/cloud/azure/stream-analytics/monitors-stream-analytics.tf +++ b/cloud/azure/stream-analytics/monitors-stream-analytics.tf @@ -20,7 +20,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "su_utilization" { @@ -50,7 +50,7 @@ warning = var.su_utilization_threshold_warning critical = var.su_utilization_threshold_critical } -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", var.su_utilization_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.su_utilization_extra_tags) } resource "datadog_monitor" "failed_function_requests" { @@ -80,7 +80,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", var.failed_function_requests_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.failed_function_requests_extra_tags) } resource "datadog_monitor" "conversion_errors" { @@ -110,7 +110,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", var.conversion_errors_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.conversion_errors_extra_tags) } resource "datadog_monitor" "runtime_errors" { @@ -140,6 +140,6 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform", var.runtime_errors_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.runtime_errors_extra_tags) } diff --git a/cloud/azure/virtual-machine/monitors-virtual-machine.tf b/cloud/azure/virtual-machine/monitors-virtual-machine.tf index f112fc8..ebed762 100644 --- a/cloud/azure/virtual-machine/monitors-virtual-machine.tf +++ b/cloud/azure/virtual-machine/monitors-virtual-machine.tf @@ -20,7 +20,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform", var.status_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "virtualmachine_cpu_usage" { @@ -50,7 +50,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform", var.cpu_usage_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform"], var.cpu_usage_extra_tags) } resource "datadog_monitor" "virtualmachine_credit_cpu_remaining_too_low" { @@ -83,6 +83,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform", var.cpu_remaining_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform"], var.cpu_remaining_rate_extra_tags) } diff --git a/cloud/gcp/big-query/monitors-big-query.tf b/cloud/gcp/big-query/monitors-big-query.tf index 3209d62..7b7b5b3 100644 --- a/cloud/gcp/big-query/monitors-big-query.tf +++ b/cloud/gcp/big-query/monitors-big-query.tf @@ -28,7 +28,7 @@ EOQ timeout_h = 0 locked = false - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.concurrent_queries_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.concurrent_queries_extra_tags) } # @@ -61,7 +61,7 @@ notify_audit = false timeout_h = 0 locked = false -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.execution_time_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.execution_time_extra_tags) } # @@ -94,7 +94,7 @@ notify_audit = false timeout_h = 0 locked = false -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.scanned_bytes_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.scanned_bytes_extra_tags) } # @@ -127,7 +127,7 @@ EOQ timeout_h = 0 locked = false - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.scanned_bytes_billed_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.scanned_bytes_billed_extra_tags) } # @@ -160,7 +160,7 @@ EOQ timeout_h = 0 locked = false - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.available_slots_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.available_slots_extra_tags) } # @@ -193,7 +193,7 @@ notify_audit = false timeout_h = 0 locked = false -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.stored_bytes_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.stored_bytes_extra_tags) } # @@ -226,7 +226,7 @@ notify_audit = false timeout_h = 0 locked = false -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.table_count_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.table_count_extra_tags) } # @@ -259,7 +259,7 @@ EOQ timeout_h = 0 locked = false - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.uploaded_bytes_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.uploaded_bytes_extra_tags) } # @@ -292,6 +292,6 @@ EOQ timeout_h = 0 locked = false - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform", var.uploaded_bytes_billed_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.uploaded_bytes_billed_extra_tags) } diff --git a/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf b/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf index 4a86734..8c27af2 100644 --- a/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf +++ b/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf @@ -28,7 +28,7 @@ EOQ notify_no_data = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.cpu_utilization_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.cpu_utilization_extra_tags) } # @@ -61,7 +61,7 @@ require_full_window = false notify_no_data = true renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.disk_utilization_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.disk_utilization_extra_tags) } # @@ -108,7 +108,7 @@ EOQ notify_no_data = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.disk_utilization_forecast_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.disk_utilization_forecast_extra_tags) } # @@ -141,7 +141,7 @@ EOQ notify_no_data = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.memory_utilization_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.memory_utilization_extra_tags) } # @@ -188,9 +188,18 @@ EOQ notify_no_data = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.memory_utilization_forecast_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.memory_utilization_forecast_extra_tags) } + # + # Failover Unavailable + # + resource "datadog_monitor" "failover_unavailable" { + count = var.failover_unavailable_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Failover Unavailable" + message = coalesce(var.failover_unavailable_message, var.message) +>>>>>>> MON-459 use concat for extra tags + # # Failover Unavailable # @@ -221,6 +230,6 @@ require_full_window = false notify_no_data = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", var.failover_unavailable_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.failover_unavailable_extra_tags) } diff --git a/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf b/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf index 50f5e6f..c529717 100644 --- a/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf +++ b/cloud/gcp/cloud-sql/mysql/monitors-cloudsql-mysql.tf @@ -28,6 +28,6 @@ EOQ notify_no_data = true renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "engine:mysql", var.replication_lag_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform", "engine:mysql"], var.replication_lag_extra_tags) } diff --git a/cloud/gcp/gce/instance/monitors-gce-instance.tf b/cloud/gcp/gce/instance/monitors-gce-instance.tf index 53d03b7..6770800 100644 --- a/cloud/gcp/gce/instance/monitors-gce-instance.tf +++ b/cloud/gcp/gce/instance/monitors-gce-instance.tf @@ -28,7 +28,7 @@ EOQ notify_no_data = true renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform", var.cpu_utilization_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.cpu_utilization_extra_tags) } # @@ -67,7 +67,7 @@ require_full_window = false notify_no_data = var.disk_throttled_bps_notify_no_data renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform", var.disk_throttled_bps_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_bps_extra_tags) } # @@ -106,6 +106,6 @@ include_tags = true require_full_window = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform", var.disk_throttled_ops_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_ops_extra_tags) } diff --git a/cloud/gcp/lb/monitors-lb.tf b/cloud/gcp/lb/monitors-lb.tf index 2db5fcf..9acefb4 100644 --- a/cloud/gcp/lb/monitors-lb.tf +++ b/cloud/gcp/lb/monitors-lb.tf @@ -29,7 +29,7 @@ EOQ notify_no_data = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.error_rate_4xx_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_4xx_extra_tags) } # @@ -63,7 +63,7 @@ require_full_window = false notify_no_data = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.error_rate_5xx_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_5xx_extra_tags) } # @@ -96,7 +96,7 @@ require_full_window = false notify_no_data = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.backend_latency_service_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.backend_latency_service_extra_tags) } # @@ -129,7 +129,7 @@ EOQ notify_no_data = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.backend_latency_bucket_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.backend_latency_bucket_extra_tags) } # @@ -162,6 +162,6 @@ EOQ notify_no_data = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform", var.request_count_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.request_count_extra_tags) } diff --git a/cloud/gcp/pubsub/monitors-pubsub.tf b/cloud/gcp/pubsub/monitors-pubsub.tf index fd3afc7..7776108 100644 --- a/cloud/gcp/pubsub/monitors-pubsub.tf +++ b/cloud/gcp/pubsub/monitors-pubsub.tf @@ -27,7 +27,7 @@ EOQ notify_no_data = true renotify_interval = 0 - tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform", var.sending_operations_count_extra_tags] + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform"], var.sending_operations_count_extra_tags) } # @@ -60,6 +60,6 @@ require_full_window = false notify_no_data = false renotify_interval = 0 -tags = ["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform", var.unavailable_sending_operations_count_extra_tags] +tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform"], var.unavailable_sending_operations_count_extra_tags) } diff --git a/database/mongodb/monitors-mongo.tf b/database/mongodb/monitors-mongo.tf index d415118..0a44cf9 100644 --- a/database/mongodb/monitors-mongo.tf +++ b/database/mongodb/monitors-mongo.tf @@ -17,7 +17,7 @@ EOQ include_tags = true require_full_window = true - tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", var.mongodb_primary_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_primary_extra_tags) } resource "datadog_monitor" "mongodb_secondary" { @@ -47,7 +47,7 @@ timeout_h = 0 include_tags = true require_full_window = true -tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", var.mongodb_secondary_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) } resource "datadog_monitor" "mongodb_server_count" { @@ -76,7 +76,7 @@ timeout_h = 0 include_tags = true require_full_window = true -tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", var.mongodb_secondary_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) } resource "datadog_monitor" "mongodb_replication" { @@ -104,6 +104,6 @@ EOQ include_tags = true require_full_window = true - tags = ["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform", var.mongodb_replication_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_replication_extra_tags) } diff --git a/database/mysql/monitors-mysql.tf b/database/mysql/monitors-mysql.tf index 7feeffe..093470c 100644 --- a/database/mysql/monitors-mysql.tf +++ b/database/mysql/monitors-mysql.tf @@ -23,7 +23,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_availability_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_availability_extra_tags) } resource "datadog_monitor" "mysql_connection" { @@ -52,7 +52,7 @@ require_full_window = true timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_connection_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_connection_extra_tags) } resource "datadog_monitor" "mysql_aborted" { @@ -81,7 +81,7 @@ require_full_window = true timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_aborted_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_aborted_extra_tags) } resource "datadog_monitor" "mysql_slow" { @@ -110,7 +110,7 @@ EOQ timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_slow_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_slow_extra_tags) } resource "datadog_monitor" "mysql_pool_efficiency" { @@ -139,7 +139,7 @@ EOQ timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_pool_efficiency_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_pool_efficiency_extra_tags) } resource "datadog_monitor" "mysql_pool_utilization" { @@ -169,7 +169,7 @@ require_full_window = true timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_pool_utilization_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_pool_utilization_extra_tags) } resource "datadog_monitor" "mysql_threads_anomaly" { @@ -206,7 +206,7 @@ require_full_window = true timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_threads_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_threads_extra_tags) } resource "datadog_monitor" "mysql_questions_anomaly" { @@ -243,6 +243,6 @@ EOQ timeout_h = 0 include_tags = true - tags = ["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform", var.mysql_questions_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_questions_extra_tags) } diff --git a/database/postgresql/monitors-postgresql.tf b/database/postgresql/monitors-postgresql.tf index 230a466..7a1ce03 100644 --- a/database/postgresql/monitors-postgresql.tf +++ b/database/postgresql/monitors-postgresql.tf @@ -23,7 +23,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform", var.postgresql_availability_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_availability_extra_tags) } resource "datadog_monitor" "postgresql_connection_too_high" { @@ -51,7 +51,7 @@ require_full_window = true timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform", var.postgresql_connection_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_connection_extra_tags) } resource "datadog_monitor" "postgresql_too_many_locks" { @@ -79,6 +79,6 @@ require_full_window = true timeout_h = 0 include_tags = true -tags = ["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform", var.postgresql_lock_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_lock_extra_tags) } diff --git a/database/redis/monitors-redis.tf b/database/redis/monitors-redis.tf index 51568b6..558beef 100644 --- a/database/redis/monitors-redis.tf +++ b/database/redis/monitors-redis.tf @@ -26,7 +26,7 @@ EOQ require_full_window = true renotify_interval = 0 - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.not_responding_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.not_responding_extra_tags) } resource "datadog_monitor" "evicted_keys" { @@ -56,7 +56,7 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.evictedkeys_change_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_change_extra_tags) } resource "datadog_monitor" "expirations" { @@ -86,7 +86,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.expirations_rate_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.expirations_rate_extra_tags) } resource "datadog_monitor" "blocked_clients" { @@ -117,7 +117,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.blocked_clients_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.blocked_clients_extra_tags) } resource "datadog_monitor" "keyspace_full" { @@ -147,7 +147,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.keyspace_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.keyspace_extra_tags) } resource "datadog_monitor" "memory_used" { @@ -178,7 +178,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.mem_used_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_used_extra_tags) } resource "datadog_monitor" "memory_frag" { @@ -208,7 +208,7 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.mem_frag_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_frag_extra_tags) } resource "datadog_monitor" "rejected_connections" { @@ -238,7 +238,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.rejected_con_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.rejected_con_extra_tags) } resource "datadog_monitor" "latency" { @@ -268,7 +268,7 @@ EOQ locked = false require_full_window = false - tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.latency_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } resource "datadog_monitor" "hitrate" { @@ -300,6 +300,6 @@ include_tags = true locked = false require_full_window = false -tags = ["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform", var.hitrate_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.hitrate_extra_tags) } diff --git a/middleware/apache/monitors-apache.tf b/middleware/apache/monitors-apache.tf index 6e34935..5d66d42 100644 --- a/middleware/apache/monitors-apache.tf +++ b/middleware/apache/monitors-apache.tf @@ -22,6 +22,6 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:middleware", "provider:apache", "resource:apache", "team:claranet", "created-by:terraform", var.apache_connect_extra_tags] + tags = concat(["env:${var.environment}", "type:middleware", "provider:apache", "resource:apache", "team:claranet", "created-by:terraform"], var.apache_connect_extra_tags) } diff --git a/middleware/nginx/monitors-nginx.tf b/middleware/nginx/monitors-nginx.tf index e255588..cabb80e 100644 --- a/middleware/nginx/monitors-nginx.tf +++ b/middleware/nginx/monitors-nginx.tf @@ -23,7 +23,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform", var.nginx_connect_extra_tags] + tags = concat(["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform"], var.nginx_connect_extra_tags) } resource "datadog_monitor" "datadog_nginx_dropped_connections" { @@ -51,6 +51,6 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform", var.nginx_dropped_extra_tags] +tags = concat(["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform"], var.nginx_dropped_extra_tags) } diff --git a/middleware/php-fpm/monitors-fpm.tf b/middleware/php-fpm/monitors-fpm.tf index 9f5984d..dfe6919 100644 --- a/middleware/php-fpm/monitors-fpm.tf +++ b/middleware/php-fpm/monitors-fpm.tf @@ -23,7 +23,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform", var.php_fpm_connect_extra_tags] + tags = concat(["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform"], var.php_fpm_connect_extra_tags) } resource "datadog_monitor" "php_fpm_connect_idle" { @@ -54,6 +54,6 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform", var.php_fpm_busy_extra_tags] +tags = concat(["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform"], var.php_fpm_busy_extra_tags) } diff --git a/system/generic/monitors-system.tf b/system/generic/monitors-system.tf index 860db6e..05f8ab7 100644 --- a/system/generic/monitors-system.tf +++ b/system/generic/monitors-system.tf @@ -24,7 +24,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:system", "provider:system-check", "resource:generic", "team:claranet", "created-by:terraform", var.cpu_extra_tags] + tags = concat(["env:${var.environment}", "type:system", "provider:system-check", "resource:generic", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } resource "datadog_monitor" "load" { @@ -53,7 +53,7 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:system", "provider:system-core", "resource:generic", "team:claranet", "created-by:terraform", var.load_extra_tags] +tags = concat(["env:${var.environment}", "type:system", "provider:system-core", "resource:generic", "team:claranet", "created-by:terraform"], var.load_extra_tags) } resource "datadog_monitor" "disk_space" { @@ -82,7 +82,7 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", var.disk_space_extra_tags] +tags = concat(["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform"], var.disk_space_extra_tags) } resource "datadog_monitor" "disk_space_forecast" { @@ -125,7 +125,7 @@ EOQ notify_no_data = false renotify_interval = 0 - tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", var.disk_space_forecast_extra_tags] + tags = concat(["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform"], var.disk_space_forecast_extra_tags) } resource "datadog_monitor" "disk_inodes" { @@ -154,7 +154,7 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform", var.disk_inodes_extra_tags] + tags = concat(["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform"], var.disk_inodes_extra_tags) } resource "datadog_monitor" "memory" { @@ -185,6 +185,6 @@ include_tags = true locked = false require_full_window = true -tags = ["env:${var.environment}", "type:system", "provider:system-check", "resource:generic", "team:claranet", "created-by:terraform", var.memory_extra_tags] +tags = concat(["env:${var.environment}", "type:system", "provider:system-check", "resource:generic", "team:claranet", "created-by:terraform"], var.memory_extra_tags) } diff --git a/system/unreachable/monitors-unreachable.tf b/system/unreachable/monitors-unreachable.tf index 91bf1ab..88cbe46 100644 --- a/system/unreachable/monitors-unreachable.tf +++ b/system/unreachable/monitors-unreachable.tf @@ -23,6 +23,6 @@ EOQ locked = false require_full_window = true - tags = ["env:${var.environment}", "type:system", "provider:host", "resource:unreachable", "team:claranet", "created-by:terraform", var.unreachable_extra_tags] + tags = concat(["env:${var.environment}", "type:system", "provider:host", "resource:unreachable", "team:claranet", "created-by:terraform"], var.unreachable_extra_tags) } From 324bc463004f1e8a8a0c9ca347afeee3cb3cddf3 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 12:35:49 +0200 Subject: [PATCH 04/26] MON-459 remove incubator --- incubator/monitors-apache-nat.tf | 45 ------ incubator/monitors-cassandra.tf | 38 ----- incubator/monitors-gcp-cloud-sql.tf | 100 ------------- incubator/monitors-gcp-lb.tf | 81 ----------- incubator/monitors-gcp-vpn.tf | 24 ---- incubator/monitors-kubernetes.tf | 131 ----------------- incubator/monitors-linux-basics.log | 33 ----- incubator/monitors-linux-basics.tf | 187 ------------------------- incubator/monitors-redis-containers.tf | 76 ---------- incubator/monitors-redis.tf | 81 ----------- incubator/versions.tf | 4 - 11 files changed, 800 deletions(-) delete mode 100644 incubator/monitors-apache-nat.tf delete mode 100644 incubator/monitors-cassandra.tf delete mode 100644 incubator/monitors-gcp-cloud-sql.tf delete mode 100644 incubator/monitors-gcp-lb.tf delete mode 100644 incubator/monitors-gcp-vpn.tf delete mode 100644 incubator/monitors-kubernetes.tf delete mode 100644 incubator/monitors-linux-basics.log delete mode 100644 incubator/monitors-linux-basics.tf delete mode 100644 incubator/monitors-redis-containers.tf delete mode 100644 incubator/monitors-redis.tf delete mode 100644 incubator/versions.tf diff --git a/incubator/monitors-apache-nat.tf b/incubator/monitors-apache-nat.tf deleted file mode 100644 index f1a2907..0000000 --- a/incubator/monitors-apache-nat.tf +++ /dev/null @@ -1,45 +0,0 @@ -resource "datadog_monitor" "apache_worker_nat" { - name = "Apache proxy busy worker > 99% on nat" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - - query = "avg(last_10m):avg:apache.performance.busy_workers{*} by {host} / ( avg:apache.performance.idle_workers{*} by {host} + avg:apache.performance.busy_workers{*} by {host} ) > 0.99" - type = "query alert" - - thresholds = { - warning = 0.95 - critical = 0.99 - } - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "apache_process_nat" { - name = "Apache proxy is down on nat" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - - query = "\"apache.can_connect\".over(\"*\").by(\"host\",\"port\").last(1).count_by_status()" - type = "service check" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - diff --git a/incubator/monitors-cassandra.tf b/incubator/monitors-cassandra.tf deleted file mode 100644 index 7218613..0000000 --- a/incubator/monitors-cassandra.tf +++ /dev/null @@ -1,38 +0,0 @@ -resource "datadog_monitor" "datadog_cassandra_down" { - name = "Cassandra service is down" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "\"cassandra.can_connect\".over(\"cassandra-node\").by(\"host\",\"instance\").last(2).count_by_status()" - type = "service check" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -/*resource "datadog_monitor" "datadog_rule_27" { -name = "OpsCenter process is down" -message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n${var.warning_HO}" -query = "\"process.up\".over(\"opscenter\",process:\"opscenter\").last(1).count_by_status()" -type = "service check" - -notify_no_data = false -renotify_interval = 60 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true -new_host_delay = 300 -notify_no_data = false -renotify_interval = 0 -no_data_timeframe = 20 - -}*/ diff --git a/incubator/monitors-gcp-cloud-sql.tf b/incubator/monitors-gcp-cloud-sql.tf deleted file mode 100644 index 75dd096..0000000 --- a/incubator/monitors-gcp-cloud-sql.tf +++ /dev/null @@ -1,100 +0,0 @@ -resource "datadog_monitor" "cloud_sql_cpu_90" { - name = "Cloud SQL CPU high > 90%" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "avg(last_5m):avg:gcp.cloudsql.database.cpu.utilization{project_id:${var.project_id}} >= 90" - type = "query alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "cloud_sql_disk_space" { - name = "Cloud SQL free disk space < 10%" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - query = "avg(last_5m):avg:gcp.cloudsql.database.disk.bytes_used{project_id:${var.project_id}} by {database_id} / avg:gcp.cloudsql.database.disk.quota{project_id:${var.project_id}} by {database_id} * 100 >= 90" - - thresholds = { - warning = 70 - critical = 90 - } - - type = "query alert" - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "cloud_sql_connection_80" { - name = "Cloud SQL MySQL connection > 80% of max connections" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "avg(last_5m):avg:gcp.cloudsql.database.network.connections{*} > 3500" - type = "metric alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "cloud_sql_lag" { - name = "Cloud SQL MySQL lag > 45min" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "min(last_10m):avg:gcp.cloudsql.database.mysql.replication.seconds_behind_master{*} by {database_id} > 2700" - type = "metric alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "cloud_sql_replication" { - name = "Cloud SQL Failover not ready to replication" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "max(last_5m):avg:gcp.cloudsql.database.mysql.replication.available_for_failover{*} <= 0" - type = "metric alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - diff --git a/incubator/monitors-gcp-lb.tf b/incubator/monitors-gcp-lb.tf deleted file mode 100644 index 6d90555..0000000 --- a/incubator/monitors-gcp-lb.tf +++ /dev/null @@ -1,81 +0,0 @@ -resource "datadog_monitor" "datadog_gcp_lb_request_count" { - name = "GCP LoadBalancer request count changed too fast" - message = "" - query = "change(sum(last_5m),last_30m):avg:gcp.loadbalancing.http.request_count{*} by {backend_name}.as_count() >= 300" - type = "query alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_gcp_lb_500" { - name = "GCP LoadBalancer 500 ratio > 5%" - message = "" - query = "sum(last_10m):avg:gcp.loadbalancing.http.request_count{response_code_class:500} by {backend_name}.as_count() / avg:gcp.loadbalancing.http.request_count{*} by {backend_name}.as_count() > 0.2" - type = "query alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_gcp_lb_backend_latency" { - name = "GCP LB backend latency > 2s" - message = "" - query = "min(last_5m):avg:gcp.loadbalancing.http.backend_latencies.avg{*} by {backend_name} > 2000" - type = "metric alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_gcp_lb_latency" { - name = "GCP LB latency > 5s" - message = "" - query = "avg(last_5m):avg:gcp.loadbalancing.http.total_latencies.avg{*} > 5000" - type = "query alert" - - thresholds = { - warning = 3000 - critical = 5000 - } - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - diff --git a/incubator/monitors-gcp-vpn.tf b/incubator/monitors-gcp-vpn.tf deleted file mode 100644 index 0d3dd5c..0000000 --- a/incubator/monitors-gcp-vpn.tf +++ /dev/null @@ -1,24 +0,0 @@ -resource "datadog_monitor" "gcp_vpn" { - name = "GCP VPN is down" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - - query = "avg(last_5m):avg:gcp.vpn.tunnel_established{*} <= 0" - - thresholds = { - critical = 0 - } - - type = "metric alert" - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - diff --git a/incubator/monitors-kubernetes.tf b/incubator/monitors-kubernetes.tf deleted file mode 100644 index f9cb2b6..0000000 --- a/incubator/monitors-kubernetes.tf +++ /dev/null @@ -1,131 +0,0 @@ -resource "datadog_monitor" "kubernetes_cluster_cpu" { - name = "Kubernetes cluster CPU High > 85%" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - query = "avg(last_5m):avg:system.cpu.system{*} by {cluster-name} + avg:system.cpu.user{*} by {cluster-name} > 85" - - thresholds = { - warning = 75 - critical = 85 - } - - type = "query alert" - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "kubernetes_kubelet_check" { - name = "Kubernetes kubelet check down" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - query = "\"kubernetes.kubelet.check\".over(\"goog-gke-node\").by(\"*\").last(1).pct_by_status()" - - thresholds = { - warning = 0 - critical = 10 - } - - type = "service check" - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "kubernetes_kubelet_ping" { - name = "Kubernetes kubelet ping not ok" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - query = "\"kubernetes.kubelet.check.ping\".over(\"goog-gke-node\").by(\"*\").last(1).pct_by_status()" - - thresholds = { - warning = 0 - critical = 10 - } - - type = "service check" - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "kubernetes_pods_unavailable" { - name = "Kubernetes pods unavailable" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - query = "max(last_5m):avg:kubernetes_state.deployment.replicas_desired{!namespace:cronetes} by {cluster-name,namespace,deployment} - avg:kubernetes_state.deployment.replicas_unavailable{!namespace:cronetes} by {cluster-name,namespace,deployment} + 1 < 1" - type = "query alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "kubernetes_node_status" { - name = "Kubernetes node status" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - query = "max(last_5m):avg:kubernetes_state.node.status{!namespace:cronetes} by {cluster-name,namespace,deployment} <= 0" - type = "metric alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -/* type = "query alert" - - thresholds { -# warning = 75 - critical = 80 - } - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -}*/ diff --git a/incubator/monitors-linux-basics.log b/incubator/monitors-linux-basics.log deleted file mode 100644 index 4d93564..0000000 --- a/incubator/monitors-linux-basics.log +++ /dev/null @@ -1,33 +0,0 @@ - name = "CPU High > 80% for 15 min" - message = "{{#is_alert}}\n${var.alert_HNO}\n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "min(last_15m):avg:system.cpu.system{!goog-gke-node} by {host} + avg:system.cpu.user{!goog-gke-node} by {host} > 80" - name = "CPU High > 95% for 5 min" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "min(last_5m):avg:system.cpu.system{!goog-gke-node} by {host} + avg:system.cpu.user{!goog-gke-node} by {host} > 95" - name = "Free disk space < 5%" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "sum(last_5m):avg:system.disk.free{*} by {host,device} / avg:system.disk.total{*} by {host,device} * 100 < 5" - name = "Free disk space < 10%" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "sum(last_5m):avg:system.disk.free{*} by {host,device} / avg:system.disk.total{*} by {host,device} * 100 < 10" - name = "Free disk space < 20%" - message = "${var.warning_HO}" - query = "sum(last_5m):avg:system.disk.free{*} by {host,device} / avg:system.disk.total{*} by {host,device} * 100 < 20" - name = "Free disk inodes < 5%" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO} \n{{/is_recovery}}" - query = "sum(last_5m):avg:system.fs.inodes.free{*} by {host,device} / avg:system.fs.inodes.total{*} by {host,device} * 100 < 5" - name = "Free disk inodes < 10%" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO} \n{{/is_recovery}}" - query = "max(last_5m):avg:system.fs.inodes.free{*} by {host,device} / avg:system.fs.inodes.total{*} by {host,device} * 100 < 10" - name = "Free disk inodes < 20%" - message = "{{#is_alert}}\n${var.warning_HO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.warning_HO} \n{{/is_recovery}}" - query = "max(last_5m):avg:system.fs.inodes.free{*} by {host,device} / avg:system.fs.inodes.total{*} by {host,device} * 100 < 20" - name = "CPU Load > 2" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO} \n{{/is_recovery}}" - query = "min(last_5m):avg:system.load.5{*} by {instance-id} / avg:gcp.gce.instance.cpu.reserved_cores{*} by {instance-id} > 2" - name = "Free memory < 5%" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO} \n{{/is_recovery}}" - query = "sum(last_1m):avg:system.mem.free{*} by {host} / avg:system.mem.total{*} by {host} * 100 < 5" - name = "Host unreachable" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO} \n{{/is_recovery}}" - query = "\"datadog.agent.up\".over(\"*\").last(1).count_by_status()" diff --git a/incubator/monitors-linux-basics.tf b/incubator/monitors-linux-basics.tf deleted file mode 100644 index eb8126b..0000000 --- a/incubator/monitors-linux-basics.tf +++ /dev/null @@ -1,187 +0,0 @@ -resource "datadog_monitor" "cpu_80_15min" { - name = "CPU High > 80% for 15 min" - message = "{{#is_alert}}\n${var.hno_escalation_group}\n{{/is_alert}}\n{{#is_recovery}}\n${var.hno_escalation_group}\n{{/is_recovery}}" - count = var.linux-basics == "enabled" ? 1 : 0 - - query = "min(last_15m):avg:system.cpu.system{dd_monitoring:enabled,!dd_custom_cpu:enabled} by {host} + avg:system.cpu.user{dd_monitoring:enabled,!dd_custom_cpu:enabled} by {host} > 80" - type = "query alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "cpu_95_5min" { - name = "CPU High > 95% for 5 min" - message = "{{#is_alert}}\n${var.hno_escalation_group}\n{{/is_alert}}\n{{#is_recovery}}\n${var.hno_escalation_group}\n{{/is_recovery}}" - - query = "min(last_5m):avg:system.cpu.system{dd_monitoring:enabled,!dd_custom_cpu:enabled} by {host} + avg:system.cpu.user{dd_monitoring:enabled,!dd_custom_cpu:enabled} by {host} > 95" - type = "query alert" - count = var.linux-basics == "enabled" ? 1 : 0 - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_free_disk_space_5" { - name = "Free disk space < 5%" - message = "{{#is_alert}}\n${var.hno_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.hno_escalation_group}\n{{/is_recovery}}" - - query = "sum(last_5m):avg:system.disk.free{*} by {host,device} / avg:system.disk.total{*} by {host,device} * 100 < 5" - type = "query alert" - count = var.linux-basics == "enabled" ? 1 : 0 - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_free_disk_space_10" { - name = "Free disk space < 10%" - message = "{{#is_alert}}\n${var.hno_escalation_group}\n{{/is_alert}}\n{{#is_recovery}}\n${var.hno_escalation_group}\n{{/is_recovery}}\n{{#is_warning}}\n${var.ho_escalation_group}\n{{/is_warning}}\n{{#is_warning_recovery}}\n${var.ho_escalation_group}\n{{/is_warning_recovery}}" - - query = "sum(last_5m):avg:system.disk.free{*} by {host,device} / avg:system.disk.total{*} by {host,device} * 100 < 10" - type = "query alert" - count = var.linux-basics == "enabled" ? 1 : 0 - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_free_disk_space_inodes_5" { - name = "Free disk inodes < 5%" - message = "{{#is_alert}}\n${var.hno_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.hno_escalation_group} \n{{/is_recovery}}" - - query = "sum(last_5m):avg:system.fs.inodes.free{*} by {host,device} / avg:system.fs.inodes.total{*} by {host,device} * 100 < 5" - type = "query alert" - count = var.linux-basics == "enabled" ? 1 : 0 - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_free_disk_space_inodes_10" { - name = "Free disk inodes < 10%" - message = "{{#is_alert}}\n${var.hno_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.hno_escalation_group} \n{{/is_recovery}}" - - query = "max(last_5m):avg:system.fs.inodes.free{*} by {host,device} / avg:system.fs.inodes.total{*} by {host,device} * 100 < 10" - type = "query alert" - count = var.linux-basics == "enabled" ? 1 : 0 - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_cpu_load" { - name = "CPU Load > 2" - message = "Debugging alert - no escalation" - - query = "min(last_5m):avg:system.load.5{*} by {instance-id} / avg:gcp.gce.instance.cpu.reserved_cores{*} by {instance-id} > 2" - type = "query alert" - count = var.linux-basics == "enabled" ? 1 : 0 - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_free_memory" { - name = "Free memory < 5%" - message = "Debugging alert - no escalation" - query = "sum(last_1m):avg:system.mem.free{*} by {host} / avg:system.mem.total{*} by {host} * 100 < 5" - type = "query alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_host_unreachable" { - name = "Host unreachable" - message = "{{#is_alert}}\n${var.hno_escalation_group} \n{{/is_alert}} \n{{#is_recovery}}\n${var.hno_escalation_group} \n{{/is_recovery}}" - - query = "\"datadog.agent.up\".over(\"*\").last(1).count_by_status()" - type = "service check" - count = var.linux-basics == "enabled" ? 1 : 0 - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = true - renotify_interval = 0 - no_data_timeframe = 20 -} - diff --git a/incubator/monitors-redis-containers.tf b/incubator/monitors-redis-containers.tf deleted file mode 100644 index ec81d43..0000000 --- a/incubator/monitors-redis-containers.tf +++ /dev/null @@ -1,76 +0,0 @@ -resource "datadog_monitor" "kubernetes_redis_cpu_95_5min" { - name = "Kubernetes Redis container CPU High > 95% for 5 min" - - #message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "avg(last_5m):avg:gcp.container.cpu.utilization{container_name:redis} by {cluster-name} * 100 > 95" - - thresholds = { - # warning = 80 - critical = 95 - } - - type = "query alert" - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "kubernetes_redis_cpu_80_15min" { - name = "Kubernetes Redis container CPU High > 80% for 15 min" - - #message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}\n{{#is_warning}}\n${var.warning_HO} \n{{/is_warning}} \n{{#is_warning_recovery}}\n${var.warning_HO}\n{{/is_warning_recovery}}" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - - query = "min(last_15m):avg:gcp.container.cpu.utilization{container_name:redis} by {cluster-name} * 100 > 80" - type = "query alert" - - thresholds = { - # warning = 75 - critical = 80 - } - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -# resource "datadog_monitor" "kubernetes_redis_oom" { -# name = "Kubernetes Redis container out of memory > 85%" -# message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n${var.warning_HO}" -# query = "avg(last_5m):avg:gcp.container.memory.bytes_used{container_name:redis} by {cluster-name} / avg:gcp.container.memory.bytes_total{container_name:redis} by {cluster-name} > 85" -# -# thresholds { -# warning = 70 -# critical = 85 -# } -# -# type = "query alert" -# notify_no_data = false -# renotify_interval = 60 -# notify_audit = false -# timeout_h = 0 -# include_tags = true -# locked = false -# require_full_window = true -# new_host_delay = 300 -# notify_no_data = false -# renotify_interval = 0 -# no_data_timeframe = 20 -# } diff --git a/incubator/monitors-redis.tf b/incubator/monitors-redis.tf deleted file mode 100644 index 9a982e0..0000000 --- a/incubator/monitors-redis.tf +++ /dev/null @@ -1,81 +0,0 @@ -resource "datadog_monitor" "redis_connection" { - name = "Redis connection is down (Datadog check)" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "\"redis.can_connect\".over(\"app:redis\").by(\"*\").last(1).pct_by_status()" - - thresholds = { - critical = 50 - warning = 5 - } - - type = "service check" - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "redis_eviction" { - name = "Redis eviction > 0" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "min(last_5m):avg:redis.keys.evicted{*} > 0" - type = "metric alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "datadog_blocked_client" { - name = "Redis blocked clients > 0" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "min(last_5m):avg:redis.clients.blocked{*} > 0" - type = "metric alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - -resource "datadog_monitor" "redis_swap" { - name = "Redis begin to swap" - message = "{{#is_alert}}\n${var.alert_HNO} \n{{/is_alert}} \n{{#is_recovery}}\n${var.alert_HNO}\n{{/is_recovery}}" - query = "avg(last_5m):avg:redis.mem.fragmentation_ratio{*} <= 0.8" - type = "metric alert" - - notify_no_data = false - renotify_interval = 60 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false - require_full_window = true - new_host_delay = 300 - notify_no_data = false - renotify_interval = 0 - no_data_timeframe = 20 -} - diff --git a/incubator/versions.tf b/incubator/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/incubator/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} From 133021c5a75004c351e34b73d5d6039005986a93 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 12:39:48 +0200 Subject: [PATCH 05/26] MON-459 fix extra tags for service bus monitors --- cloud/azure/servicebus/inputs.tf | 26 ++++++++++++++++--- .../azure/servicebus/monitors-service-bus.tf | 6 ++--- .../common/monitors-cloud-sql-common.tf | 8 +++--- 3 files changed, 29 insertions(+), 11 deletions(-) diff --git a/cloud/azure/servicebus/inputs.tf b/cloud/azure/servicebus/inputs.tf index d70daee..2f5202c 100644 --- a/cloud/azure/servicebus/inputs.tf +++ b/cloud/azure/servicebus/inputs.tf @@ -70,25 +70,31 @@ variable "status_timeframe" { } variable "no_active_connections_enabled" { - description = "Flag to enable Service Bus status monitor" + description = "Flag to enable Service Bus no active connections monitor" type = string default = "true" } +variable "no_active_connections_extra_tags" { + description = "Extra tags for Service Bus no active connections monitor" + type = list(string) + default = [] +} + variable "no_active_connections_message" { - description = "Custom message for Service Bus status monitor" + description = "Custom message for Service Bus no active connections monitor" type = string default = "" } variable "no_active_connections_time_aggregator" { - description = "Monitor aggregator for Service Bus status [available values: min, max or avg]" + description = "Monitor aggregator for Service Bus no active connections [available values: min, max or avg]" type = string default = "max" } variable "no_active_connections_timeframe" { - description = "Monitor timeframe for Service Bus status [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" + description = "Monitor timeframe for Service Bus no active connections [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`]" type = string default = "last_5m" } @@ -105,6 +111,12 @@ variable "server_errors_enabled" { default = "true" } +variable "server_errors_extra_tags" { + description = "Extra tags for Service Bus server errors monitor" + type = list(string) + default = [] +} + variable "server_errors_time_aggregator" { description = "Monitor aggregator for Service Bus server errors [available values: min, max or avg]" type = string @@ -139,6 +151,12 @@ variable "user_errors_enabled" { default = "true" } +variable "user_errors_extra_tags" { + description = "Extra tags for Service Bus user errors monitor" + type = list(string) + default = [] +} + variable "user_errors_time_aggregator" { description = "Monitor aggregator for Service Bus user errors [available values: min, max or avg]" type = string diff --git a/cloud/azure/servicebus/monitors-service-bus.tf b/cloud/azure/servicebus/monitors-service-bus.tf index 3db613b..7b528f9 100644 --- a/cloud/azure/servicebus/monitors-service-bus.tf +++ b/cloud/azure/servicebus/monitors-service-bus.tf @@ -45,7 +45,7 @@ include_tags = true locked = false require_full_window = false -tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] +tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"], var.no_active_connections_extra_tags) } resource "datadog_monitor" "service_bus_user_errors" { @@ -76,7 +76,7 @@ include_tags = true locked = false require_full_window = false -tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] +tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"], var.user_errors_extra_tags) } resource "datadog_monitor" "service_bus_server_errors" { @@ -107,6 +107,6 @@ EOQ locked = false require_full_window = false - tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"] + tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"], var.server_errors_extra_tags) } diff --git a/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf b/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf index 8c27af2..958820c 100644 --- a/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf +++ b/cloud/gcp/cloud-sql/common/monitors-cloud-sql-common.tf @@ -25,8 +25,8 @@ EOQ timeout_h = 0 include_tags = true require_full_window = false - notify_no_data = false - renotify_interval = 0 + notify_no_data = false + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.cpu_utilization_extra_tags) } @@ -138,8 +138,8 @@ EOQ timeout_h = 0 include_tags = true require_full_window = false - notify_no_data = false - renotify_interval = 0 + notify_no_data = false + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.memory_utilization_extra_tags) } From a5421ee6a7368d8160c7e98c9f4e21fcaf2f2173 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 12:54:00 +0200 Subject: [PATCH 06/26] MON-459 update outputs script to support 0.12 syntax --- scripts/01_update_output.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/01_update_output.sh b/scripts/01_update_output.sh index f11cbd2..0e117db 100755 --- a/scripts/01_update_output.sh +++ b/scripts/01_update_output.sh @@ -15,7 +15,7 @@ for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors cat >> outputs.tf < Date: Thu, 27 Jun 2019 13:03:48 +0200 Subject: [PATCH 07/26] MON-459 update script to delete testing and incubator directories --- scripts/01_update_output.sh | 2 +- scripts/02_update_readme.sh | 4 ++-- scripts/03_update_module.sh | 2 +- scripts/90_best_practices.sh | 2 +- scripts/99_terraform.sh | 2 +- testing/dummy/dummy.tf | 3 --- testing/dummy/versions.tf | 4 ---- testing/inputs.tf | 22 ---------------------- testing/main.tf | 4 ---- testing/modules.tf | 12 ------------ 10 files changed, 6 insertions(+), 51 deletions(-) delete mode 100644 testing/dummy/dummy.tf delete mode 100644 testing/dummy/versions.tf delete mode 100644 testing/inputs.tf delete mode 100644 testing/main.tf delete mode 100644 testing/modules.tf diff --git a/scripts/01_update_output.sh b/scripts/01_update_output.sh index 0e117db..eb0167f 100755 --- a/scripts/01_update_output.sh +++ b/scripts/01_update_output.sh @@ -5,7 +5,7 @@ source "$(dirname $0)/utils.sh" goto_root # loop over every monitors set -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do +for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) # empty outputs > outputs.tf diff --git a/scripts/02_update_readme.sh b/scripts/02_update_readme.sh index 7918e9f..eba210e 100755 --- a/scripts/02_update_readme.sh +++ b/scripts/02_update_readme.sh @@ -10,7 +10,7 @@ sed -i '/### Monitors summary ###/q' README.md # add a newline after listing section echo >> README.md # loop over all ready monitors sets on the repo -for path in $(find -mindepth 1 \( -path './incubator' -o -path './scripts' -o -path './testing' -o -path '*/\.*' \) -prune -o -type d -print | sort -fdbi); do +for path in $(find -mindepth 1 -type d ! -path '*/.*' ! -path './scripts*' -print | sort -fdbi); do # split path in directories directories=($(list_dirs $path)) # loop over directories in path @@ -32,7 +32,7 @@ done PATTERN_DOC="Related documentation" # loop over every monitors set readme -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do +for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) EXIST=0 if [ -f README.md ]; then diff --git a/scripts/03_update_module.sh b/scripts/03_update_module.sh index 4458c20..3d28737 100755 --- a/scripts/03_update_module.sh +++ b/scripts/03_update_module.sh @@ -7,7 +7,7 @@ goto_root root=$(basename ${PWD}) # loop over every monitors set -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do +for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); do cd $(dirname $path) # get name of the monitors set directory resource="$(basename $(dirname $path))" diff --git a/scripts/90_best_practices.sh b/scripts/90_best_practices.sh index 12be77b..a44afb5 100755 --- a/scripts/90_best_practices.sh +++ b/scripts/90_best_practices.sh @@ -5,7 +5,7 @@ source "$(dirname $0)/utils.sh" goto_root # loop over every monitors set -for path in $(find "$(get_scope $1)" -path ./incubator -prune -o -name 'monitors-*.tf' -print | sort -fdbi); do +for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); do # check if there is more than 1 notify_no_data parameter set to true per set of monitors if [[ $(grep -c notify_no_data.*true $path) -gt 1 ]]; then echo "More than one notify_no_data set to true on $path" diff --git a/scripts/99_terraform.sh b/scripts/99_terraform.sh index eb54644..346c9e1 100755 --- a/scripts/99_terraform.sh +++ b/scripts/99_terraform.sh @@ -4,7 +4,7 @@ set -xueo pipefail source "$(dirname $0)/utils.sh" goto_root -for path in $(find "$(get_scope $1)" -path ./testing -prune -o -path ./incubator -prune -o -name 'inputs.tf' -print); do +for path in $(find "$(get_scope $1)" -name 'inputs.tf' -print); do dir=$(dirname ${path}) terraform init ${dir} >> /dev/null 2>&1 terraform validate -check-variables=false ${dir} diff --git a/testing/dummy/dummy.tf b/testing/dummy/dummy.tf deleted file mode 100644 index 3a08ce1..0000000 --- a/testing/dummy/dummy.tf +++ /dev/null @@ -1,3 +0,0 @@ -resource "null_resource" "test-migration" { -} - diff --git a/testing/dummy/versions.tf b/testing/dummy/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/testing/dummy/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/testing/inputs.tf b/testing/inputs.tf deleted file mode 100644 index 2cff9ea..0000000 --- a/testing/inputs.tf +++ /dev/null @@ -1,22 +0,0 @@ -variable environment {} - -variable region {} - -variable "critical_escalation_group" { - default = "@pagerduty_HODummy" -} - -variable "warning_escalation_group" { - default = "@pagerduty_HNODummy" -} - -variable "datadog_api_key" {} -variable "datadog_app_key" {} - -variable "dd_system" { - default = "enabled" -} - -variable "dd_aws_rds" { - default = "enabled" -} diff --git a/testing/main.tf b/testing/main.tf deleted file mode 100644 index 96b9614..0000000 --- a/testing/main.tf +++ /dev/null @@ -1,4 +0,0 @@ -provider "datadog" { - api_key = "${var.datadog_api_key}" - app_key = "${var.datadog_app_key}" -} diff --git a/testing/modules.tf b/testing/modules.tf deleted file mode 100644 index 0e2907d..0000000 --- a/testing/modules.tf +++ /dev/null @@ -1,12 +0,0 @@ -module "datadog-monitors" { - source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git" - - env = "${var.environment}" - region = "${var.region}" - - critical_escalation_group = "${var.critical_escalation_group}" - warning_escalation_group = "${var.warning_escalation_group}" - - dd_aws_rds = "${var.dd_aws_rds}" - dd_system = "${var.dd_system}" -} From 5c8ba69da752ce2e185f70134da42339c31ca2b0 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 13:29:59 +0200 Subject: [PATCH 08/26] MON-459 update terraform ci script to handle O.12 behavior --- scripts/99_terraform.sh | 27 ++++++++++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/scripts/99_terraform.sh b/scripts/99_terraform.sh index 346c9e1..534c33a 100755 --- a/scripts/99_terraform.sh +++ b/scripts/99_terraform.sh @@ -6,8 +6,29 @@ goto_root for path in $(find "$(get_scope $1)" -name 'inputs.tf' -print); do dir=$(dirname ${path}) - terraform init ${dir} >> /dev/null 2>&1 - terraform validate -check-variables=false ${dir} + cd $dir + cat < tmp.tf +provider "datadog" { + version = "2.0.2" + + api_key = "\${var.datadog_api_key}" + app_key = "\${var.datadog_app_key}" +} + +variable "datadog_api_key" { + type = string + default = "xxx" +} + +variable "datadog_app_key" { + type = string + default = "yyy" +} +EOF + terraform init + terraform validate + rm -f tmp.tf + cd - done -terraform fmt +terraform fmt -recursive From 5f2883546a2a75afd9c8be9fbff081fe8bc762d2 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 14:02:24 +0200 Subject: [PATCH 09/26] MON-459 homogenize tags for elasticsearch monitors --- .../elasticsearch/monitors-elasticsearch.tf | 44 +++++++++---------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/database/elasticsearch/monitors-elasticsearch.tf b/database/elasticsearch/monitors-elasticsearch.tf index 369183f..4322c4c 100644 --- a/database/elasticsearch/monitors-elasticsearch.tf +++ b/database/elasticsearch/monitors-elasticsearch.tf @@ -26,7 +26,7 @@ EOQ require_full_window = true renotify_interval = 0 - tags = ["created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", "env:${var.environment}", "resource:elasticsearch", var.not_responding_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.not_responding_extra_tags) } # @@ -58,7 +58,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.cluster_status_not_green_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cluster_status_not_green_extra_tags) } # @@ -89,7 +89,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.cluster_initializing_shards_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cluster_initializing_shards_extra_tags) } # @@ -120,7 +120,7 @@ EOQ require_full_window = true notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.cluster_relocating_shards_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cluster_relocating_shards_extra_tags) } # @@ -152,7 +152,7 @@ EOQ notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.cluster_unassigned_shards_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cluster_unassigned_shards_extra_tags) } # @@ -187,7 +187,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.node_free_space_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.node_free_space_extra_tags) } # @@ -218,7 +218,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_heap_memory_usage_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_heap_memory_usage_extra_tags) } # @@ -249,7 +249,7 @@ EOQ require_full_window = true notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_memory_young_usage_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_memory_young_usage_extra_tags) } # @@ -280,7 +280,7 @@ EOQ require_full_window = true notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_memory_old_usage_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_memory_old_usage_extra_tags) } # @@ -311,7 +311,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_gc_old_collection_latency_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_gc_old_collection_latency_extra_tags) } # @@ -342,7 +342,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.jvm_gc_young_collection_latency_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_gc_young_collection_latency_extra_tags) } # @@ -374,7 +374,7 @@ EOQ require_full_window = true notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.indexing_latency_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.indexing_latency_extra_tags) } # @@ -406,7 +406,7 @@ EOQ require_full_window = true notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.flush_latency_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.flush_latency_extra_tags) } # @@ -445,7 +445,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.http_connections_anomaly_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.http_connections_anomaly_extra_tags) } # @@ -477,7 +477,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.search_query_latency_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.search_query_latency_extra_tags) } # @@ -509,7 +509,7 @@ EOQ require_full_window = true notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.fetch_latency_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.fetch_latency_extra_tags) } # @@ -540,7 +540,7 @@ EOQ require_full_window = true notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.search_query_change_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.search_query_change_extra_tags) } # @@ -571,7 +571,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.fetch_change_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.fetch_change_extra_tags) } # @@ -603,7 +603,7 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.field_data_evictions_change_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.field_data_evictions_change_extra_tags) } # @@ -635,7 +635,7 @@ EOQ require_full_window = true notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.query_cache_evictions_change_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.query_cache_evictions_change_extra_tags) } # @@ -667,7 +667,7 @@ EOQ require_full_window = true notify_no_data = false - tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.request_cache_evictions_change_extra_tags] + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.request_cache_evictions_change_extra_tags) } # @@ -698,6 +698,6 @@ include_tags = true require_full_window = true notify_no_data = false -tags = ["resource:elasticsearch", "env:${var.environment}", "created-by:terraform", "team:claranet", "type:database", "provider:elasticsearch", var.task_time_in_queue_change_extra_tags] +tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.task_time_in_queue_change_extra_tags) } From 6f83f0ddc988252ed59222801fb6680ac30c413b Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 14:06:50 +0200 Subject: [PATCH 10/26] MON-459 avoid create .terraform directory for each module --- scripts/99_terraform.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/99_terraform.sh b/scripts/99_terraform.sh index 534c33a..208979d 100755 --- a/scripts/99_terraform.sh +++ b/scripts/99_terraform.sh @@ -6,8 +6,7 @@ goto_root for path in $(find "$(get_scope $1)" -name 'inputs.tf' -print); do dir=$(dirname ${path}) - cd $dir - cat < tmp.tf + cat < ${dir}/tmp.tf provider "datadog" { version = "2.0.2" @@ -25,10 +24,9 @@ variable "datadog_app_key" { default = "yyy" } EOF - terraform init - terraform validate - rm -f tmp.tf - cd - + terraform init ${dir} + terraform validate ${dir} + rm -f ${dir}/tmp.tf done terraform fmt -recursive From 2856ba3b78ae0358d44bff36b18de2d71b047cf8 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 14:13:30 +0200 Subject: [PATCH 11/26] MON-459 bump terraform image to 0.12.3 --- .gitlab-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c2f5f05..a9a7e8b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -11,7 +11,7 @@ before_script: - apk add --no-cache curl auto_update: - image: hashicorp/terraform:0.12.1 + image: hashicorp/terraform:0.12.3 stage: test script: - apk add --no-cache bash git grep coreutils From c574e07f879b3b051f8fe3e41e9e9e54b9e0748d Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 16:24:08 +0200 Subject: [PATCH 12/26] MON-459 update readme script to works with terraform 0.12 --- scripts/02_update_readme.sh | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/scripts/02_update_readme.sh b/scripts/02_update_readme.sh index eba210e..ba44bd4 100755 --- a/scripts/02_update_readme.sh +++ b/scripts/02_update_readme.sh @@ -4,6 +4,10 @@ set -xueo pipefail source "$(dirname $0)/utils.sh" goto_root +# download awk script to hack terraform-docs +TERRAFORM_AWK="/tmp/terraform-docs.awk" +curl -Lo ${TERRAFORM_AWK} "https://raw.githubusercontent.com/cloudposse/build-harness/master/bin/terraform-docs.awk" + ## root README generator # only keep current README from begining to "Monitors summary" section (delete monitors list) sed -i '/### Monitors summary ###/q' README.md @@ -91,8 +95,12 @@ EOF done IFS=$SAVEIFS echo >> README.md + # hack for terraform-docs with terraform 0.12 / HCL2 support + tmp_tf=$(mktemp -d) + awk -f ${TERRAFORM_AWK} ./*.tf > ${tmp_tf}/main.tf # auto generate terraform docs (inputs and outputs) - terraform-docs --with-aggregate-type-defaults md table ./ >> README.md + terraform-docs --with-aggregate-type-defaults md table ${tmp_tf}/ >> README.md + rm -fr ${tmp_tf} # if README does not exist if [[ $EXIST -eq 0 ]]; then # Simply add empty documentation section From 53714ad8fc147523673118f20c61d45933f09080 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 16:25:36 +0200 Subject: [PATCH 13/26] MON-459 update all readme with new hack --- caas/kubernetes/ark/README.md | 2 +- caas/kubernetes/cluster/README.md | 2 +- caas/kubernetes/ingress/vts/README.md | 6 +- .../ingress/vts/monitors-ingress.tf | 2 +- caas/kubernetes/node/README.md | 30 ++++---- caas/kubernetes/node/monitors-k8s-node.tf | 20 +++--- caas/kubernetes/pod/README.md | 4 +- caas/kubernetes/pod/monitors-k8s-pod.tf | 8 +-- caas/kubernetes/workload/README.md | 14 ++-- .../workload/monitors-k8s-workload.tf | 10 +-- cloud/aws/alb/README.md | 16 ++--- cloud/aws/alb/monitors-alb.tf | 18 ++--- cloud/aws/apigateway/README.md | 9 ++- cloud/aws/apigateway/monitors-api.tf | 6 +- cloud/aws/elasticache/common/README.md | 16 ++--- .../common/monitors-elasticache.tf | 6 +- cloud/aws/elasticache/memcached/README.md | 4 +- .../memcached/monitors-memcached.tf | 2 +- cloud/aws/elasticache/redis/README.md | 10 ++- cloud/aws/elasticache/redis/monitors-redis.tf | 4 +- cloud/aws/elasticsearch/README.md | 9 ++- .../elasticsearch/monitors-elasticsearch.tf | 4 +- cloud/aws/elb/README.md | 16 ++--- cloud/aws/elb/monitors-elb.tf | 6 +- cloud/aws/kinesis-firehose/README.md | 2 +- .../monitors-kinesis-firehose.tf | 2 +- cloud/aws/rds/aurora/mysql/README.md | 2 +- .../aurora/mysql/monitors-rds-aurora-mysql.tf | 2 +- cloud/aws/rds/aurora/postgresql/README.md | 2 +- .../monitors-rds-aurora-postgresql.tf | 2 +- cloud/aws/rds/common/README.md | 7 +- cloud/aws/rds/common/monitors-rds-common.tf | 4 +- cloud/aws/vpn/README.md | 2 +- cloud/aws/vpn/monitors-vpn.tf | 4 +- cloud/azure/apimanagement/README.md | 12 ++-- .../monitors-azure-apimanagement.tf | 10 +-- cloud/azure/app-services/README.md | 16 ++--- .../app-services/monitors-app_services.tf | 16 ++--- cloud/azure/azure-search/README.md | 4 +- .../azure-search/monitors-azure-search.tf | 6 +- cloud/azure/cosmosdb/README.md | 12 ++-- cloud/azure/cosmosdb/monitors-cosmosdb.tf | 8 +-- cloud/azure/datalakestore/README.md | 2 +- .../datalakestore/monitors-datalakestore.tf | 4 +- cloud/azure/eventgrid/README.md | 7 +- cloud/azure/eventgrid/monitors-eventgrid.tf | 4 +- cloud/azure/eventhub/README.md | 7 +- cloud/azure/eventhub/monitors-eventhub.tf | 4 +- cloud/azure/functions/README.md | 9 ++- cloud/azure/functions/monitors-functions.tf | 6 +- cloud/azure/iothubs/README.md | 42 +++++------ cloud/azure/iothubs/monitors-iothubs.tf | 20 +++--- cloud/azure/keyvault/README.md | 9 ++- cloud/azure/keyvault/monitors-keyvault.tf | 12 ++-- cloud/azure/load-balancer/README.md | 2 +- .../load-balancer/monitors-load-balancer.tf | 4 +- cloud/azure/mysql/README.md | 10 ++- cloud/azure/mysql/monitors-mysql.tf | 4 +- cloud/azure/postgresql/README.md | 14 ++-- .../azure/postgresql/monitors-postegresql.tf | 6 +- cloud/azure/redis/README.md | 10 ++- cloud/azure/redis/monitors-azure-redis.tf | 4 +- cloud/azure/serverfarms/README.md | 9 ++- .../serverfarms/monitors-azure-serverfarms.tf | 4 +- cloud/azure/servicebus/README.md | 17 ++--- .../azure/servicebus/monitors-service-bus.tf | 8 +-- cloud/azure/sql-database/README.md | 14 ++-- .../sql-database/monitors-sql-database.tf | 6 +- cloud/azure/sql-elasticpool/README.md | 7 +- .../monitors-sql-elasticpool.tf | 4 +- cloud/azure/storage/README.md | 24 +++---- cloud/azure/storage/monitors-azure-storage.tf | 18 ++--- cloud/azure/stream-analytics/README.md | 14 ++-- .../monitors-stream-analytics.tf | 7 +- cloud/azure/virtual-machine/README.md | 9 ++- .../monitors-virtual-machine.tf | 6 +- cloud/gcp/big-query/README.md | 26 +++---- cloud/gcp/big-query/monitors-big-query.tf | 26 +++---- cloud/gcp/cloud-sql/common/README.md | 20 +++--- .../common/monitors-cloud-sql-common.tf | 61 +++++++--------- cloud/gcp/cloud-sql/mysql/README.md | 2 +- .../mysql/monitors-cloudsql-mysql.tf | 2 +- cloud/gcp/gce/instance/README.md | 7 +- .../gcp/gce/instance/monitors-gce-instance.tf | 8 +-- cloud/gcp/lb/README.md | 14 ++-- cloud/gcp/lb/monitors-lb.tf | 14 ++-- cloud/gcp/pubsub/README.md | 4 +- cloud/gcp/pubsub/monitors-pubsub.tf | 6 +- database/elasticsearch/README.md | 64 +++++++---------- .../elasticsearch/monitors-elasticsearch.tf | 70 +++++++++---------- database/mongodb/README.md | 8 +-- database/mongodb/monitors-mongo.tf | 4 +- database/mysql/README.md | 24 +++---- database/mysql/monitors-mysql.tf | 24 +++---- database/postgresql/README.md | 9 ++- database/postgresql/monitors-postgresql.tf | 8 +-- database/redis/README.md | 28 ++++---- database/redis/monitors-redis.tf | 10 +-- middleware/apache/README.md | 2 +- middleware/apache/monitors-apache.tf | 2 +- middleware/nginx/README.md | 6 +- middleware/nginx/monitors-nginx.tf | 2 +- middleware/php-fpm/README.md | 6 +- middleware/php-fpm/monitors-fpm.tf | 2 +- system/generic/README.md | 16 ++--- system/generic/monitors-system.tf | 10 +-- system/unreachable/README.md | 2 +- system/unreachable/monitors-unreachable.tf | 2 +- 108 files changed, 533 insertions(+), 620 deletions(-) diff --git a/caas/kubernetes/ark/README.md b/caas/kubernetes/ark/README.md index 1950b0c..2a102bf 100644 --- a/caas/kubernetes/ark/README.md +++ b/caas/kubernetes/ark/README.md @@ -23,7 +23,7 @@ Creates DataDog monitors with the following checks: | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | ark\_schedules\_enabled | Flag to enable Ark schedules monitor | string | `"true"` | no | -| ark\_schedules\_extra\_tags | Extra tags for Ark schedules monitor | list | `[]` | no | +| ark\_schedules\_extra\_tags | Extra tags for Ark schedules monitor | list(string) | `[]` | no | | ark\_schedules\_monitor\_message | Custom message for Ark schedules monitor | string | `""` | no | | ark\_schedules\_monitor\_no\_data\_timeframe | No data timeframe in minutes | string | `"1440"` | no | | ark\_schedules\_monitor\_timeframe | Monitor timeframe for Ark schedules monitor [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_1d"` | no | diff --git a/caas/kubernetes/cluster/README.md b/caas/kubernetes/cluster/README.md index 21c1dc4..088caef 100644 --- a/caas/kubernetes/cluster/README.md +++ b/caas/kubernetes/cluster/README.md @@ -23,7 +23,7 @@ Creates DataDog monitors with the following checks: | Name | Description | Type | Default | Required | |------|-------------|:----:|:-----:|:-----:| | apiserver\_enabled | Flag to enable API server monitor | string | `"true"` | no | -| apiserver\_extra\_tags | Extra tags for API server monitor | list | `[]` | no | +| apiserver\_extra\_tags | Extra tags for API server monitor | list(string) | `[]` | no | | apiserver\_message | Custom message for API server monitor | string | `""` | no | | apiserver\_threshold\_warning | API server monitor (warning threshold) | string | `"3"` | no | | environment | Architecture environment | string | n/a | yes | diff --git a/caas/kubernetes/ingress/vts/README.md b/caas/kubernetes/ingress/vts/README.md index 6ab32ac..9e12ad1 100644 --- a/caas/kubernetes/ingress/vts/README.md +++ b/caas/kubernetes/ingress/vts/README.md @@ -16,8 +16,8 @@ module "datadog-monitors-caas-kubernetes-ingress-vts" { Creates DataDog monitors with the following checks: -- Nginx Ingress 4xx errors - Nginx Ingress 5xx errors +- Nginx Ingress 4xx errors ## Inputs @@ -30,14 +30,14 @@ Creates DataDog monitors with the following checks: | filter\_tags\_custom\_excluded | Tags excluded for custom filtering when filter_tags_use_defaults is false | string | `""` | no | | filter\_tags\_use\_defaults | Use default filter tags convention | string | `"true"` | no | | ingress\_4xx\_enabled | Flag to enable Ingress 4xx errors monitor | string | `"true"` | no | -| ingress\_4xx\_extra\_tags | Extra tags for Ingress 4xx errors monitor | list | `[]` | no | +| ingress\_4xx\_extra\_tags | Extra tags for Ingress 4xx errors monitor | list(string) | `[]` | no | | ingress\_4xx\_message | Message sent when an alert is triggered | string | `""` | no | | ingress\_4xx\_threshold\_critical | 4xx critical threshold in percentage | string | `"40"` | no | | ingress\_4xx\_threshold\_warning | 4xx warning threshold in percentage | string | `"20"` | no | | ingress\_4xx\_time\_aggregator | Monitor aggregator for Ingress 4xx errors [available values: min, max or avg] | string | `"min"` | no | | ingress\_4xx\_timeframe | Monitor timeframe for Ingress 4xx errors [available values: `last_#m` (1, 5, 10, 15, or 30), `last_#h` (1, 2, or 4), or `last_1d`] | string | `"last_5m"` | no | | ingress\_5xx\_enabled | Flag to enable Ingress 5xx errors monitor | string | `"true"` | no | -| ingress\_5xx\_extra\_tags | Extra tags for Ingress 5xx errors monitor | list | `[]` | no | +| ingress\_5xx\_extra\_tags | Extra tags for Ingress 5xx errors monitor | list(string) | `[]` | no | | ingress\_5xx\_message | Message sent when an alert is triggered | string | `""` | no | | ingress\_5xx\_threshold\_critical | 5xx critical threshold in percentage | string | `"20"` | no | | ingress\_5xx\_threshold\_warning | 5xx warning threshold in percentage | string | `"10"` | no | diff --git a/caas/kubernetes/ingress/vts/monitors-ingress.tf b/caas/kubernetes/ingress/vts/monitors-ingress.tf index d665ad7..ebdecf1 100644 --- a/caas/kubernetes/ingress/vts/monitors-ingress.tf +++ b/caas/kubernetes/ingress/vts/monitors-ingress.tf @@ -2,7 +2,7 @@ resource "datadog_monitor" "nginx_ingress_too_many_5xx" { count = var.ingress_5xx_enabled == "true" ? 1 : 0 name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Nginx Ingress 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.ingress_5xx_message, var.message) - type = "query alert" + type = "query alert" query = <>>>>>> MON-459 use concat for extra tags + type = "metric alert" -# -# Failover Unavailable -# -resource "datadog_monitor" "failover_unavailable" { -count = var.failover_unavailable_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Failover Unavailable" -message = coalesce(var.failover_unavailable_message, var.message) -type = "metric alert" - -query = < Date: Thu, 27 Jun 2019 19:33:30 +0200 Subject: [PATCH 14/26] MON-459 fix format and add test ci optional support --- scripts/99_terraform.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scripts/99_terraform.sh b/scripts/99_terraform.sh index 208979d..3abb356 100755 --- a/scripts/99_terraform.sh +++ b/scripts/99_terraform.sh @@ -10,8 +10,8 @@ for path in $(find "$(get_scope $1)" -name 'inputs.tf' -print); do provider "datadog" { version = "2.0.2" - api_key = "\${var.datadog_api_key}" - app_key = "\${var.datadog_app_key}" + api_key = var.datadog_api_key + app_key = var.datadog_app_key } variable "datadog_api_key" { @@ -23,7 +23,11 @@ variable "datadog_app_key" { type = string default = "yyy" } + EOF + if [ -f ${dir}/test.tf.ci ]; then + cat ${dir}/test.tf.ci >> ${dir}/tmp.tf + fi terraform init ${dir} terraform validate ${dir} rm -f ${dir}/tmp.tf From 516943ce09bba8c7fe1d40b17de2973b86dcc245 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 21:11:07 +0200 Subject: [PATCH 15/26] MON-459 new format for readme and module generators --- scripts/02_update_readme.sh | 4 ++-- scripts/03_update_module.sh | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/02_update_readme.sh b/scripts/02_update_readme.sh index ba44bd4..769ee36 100755 --- a/scripts/02_update_readme.sh +++ b/scripts/02_update_readme.sh @@ -62,8 +62,8 @@ for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); module "datadog-monitors-${module_dash}" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//${module_slash}?ref={revision}" - environment = "\${var.environment}" - message = "\${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message EOF # if README already exist diff --git a/scripts/03_update_module.sh b/scripts/03_update_module.sh index 3d28737..6941230 100755 --- a/scripts/03_update_module.sh +++ b/scripts/03_update_module.sh @@ -27,10 +27,10 @@ for path in $(find "$(get_scope $1)" -name 'monitors-*.tf' -print | sort -fdbi); module "filter-tags" { source = "${relative}common/filter-tags" - environment = "\${var.environment}" + environment = var.environment resource = "$resource" - filter_tags_use_defaults = "\${var.filter_tags_use_defaults}" - filter_tags_custom = "\${var.filter_tags_custom}" + filter_tags_use_defaults = var.filter_tags_use_defaults + filter_tags_custom = var.filter_tags_custom } EOF fi From d29b9876235bd429bc32df43b0575c590a84c006 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 27 Jun 2019 21:16:05 +0200 Subject: [PATCH 16/26] MON-459 update readme with new format --- caas/kubernetes/ark/README.md | 4 ++-- caas/kubernetes/cluster/README.md | 4 ++-- caas/kubernetes/ingress/vts/README.md | 4 ++-- caas/kubernetes/node/README.md | 4 ++-- caas/kubernetes/pod/README.md | 4 ++-- caas/kubernetes/workload/README.md | 4 ++-- cloud/aws/alb/README.md | 4 ++-- cloud/aws/apigateway/README.md | 4 ++-- cloud/aws/elasticache/common/README.md | 4 ++-- cloud/aws/elasticache/memcached/README.md | 4 ++-- cloud/aws/elasticache/redis/README.md | 4 ++-- cloud/aws/elasticsearch/README.md | 4 ++-- cloud/aws/elb/README.md | 4 ++-- cloud/aws/kinesis-firehose/README.md | 4 ++-- cloud/aws/rds/aurora/mysql/README.md | 4 ++-- cloud/aws/rds/aurora/postgresql/README.md | 4 ++-- cloud/aws/rds/common/README.md | 4 ++-- cloud/aws/vpn/README.md | 4 ++-- cloud/azure/apimanagement/README.md | 4 ++-- cloud/azure/app-services/README.md | 4 ++-- cloud/azure/azure-search/README.md | 4 ++-- cloud/azure/cosmosdb/README.md | 4 ++-- cloud/azure/datalakestore/README.md | 4 ++-- cloud/azure/eventgrid/README.md | 4 ++-- cloud/azure/eventhub/README.md | 4 ++-- cloud/azure/functions/README.md | 4 ++-- cloud/azure/iothubs/README.md | 4 ++-- cloud/azure/keyvault/README.md | 4 ++-- cloud/azure/load-balancer/README.md | 4 ++-- cloud/azure/mysql/README.md | 4 ++-- cloud/azure/postgresql/README.md | 4 ++-- cloud/azure/redis/README.md | 4 ++-- cloud/azure/serverfarms/README.md | 4 ++-- cloud/azure/servicebus/README.md | 4 ++-- cloud/azure/sql-database/README.md | 4 ++-- cloud/azure/sql-elasticpool/README.md | 4 ++-- cloud/azure/storage/README.md | 4 ++-- cloud/azure/stream-analytics/README.md | 4 ++-- cloud/azure/virtual-machine/README.md | 4 ++-- cloud/gcp/big-query/README.md | 4 ++-- cloud/gcp/cloud-sql/common/README.md | 4 ++-- cloud/gcp/cloud-sql/mysql/README.md | 4 ++-- cloud/gcp/gce/instance/README.md | 4 ++-- cloud/gcp/lb/README.md | 4 ++-- cloud/gcp/pubsub/README.md | 4 ++-- database/elasticsearch/README.md | 4 ++-- database/mongodb/README.md | 4 ++-- database/mysql/README.md | 4 ++-- database/postgresql/README.md | 4 ++-- database/redis/README.md | 4 ++-- middleware/apache/README.md | 4 ++-- middleware/nginx/README.md | 4 ++-- middleware/php-fpm/README.md | 4 ++-- system/generic/README.md | 4 ++-- system/unreachable/README.md | 4 ++-- 55 files changed, 110 insertions(+), 110 deletions(-) diff --git a/caas/kubernetes/ark/README.md b/caas/kubernetes/ark/README.md index 2a102bf..1d3d142 100644 --- a/caas/kubernetes/ark/README.md +++ b/caas/kubernetes/ark/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-caas-kubernetes-ark" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//caas/kubernetes/ark?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/caas/kubernetes/cluster/README.md b/caas/kubernetes/cluster/README.md index 088caef..2a41621 100644 --- a/caas/kubernetes/cluster/README.md +++ b/caas/kubernetes/cluster/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-caas-kubernetes-cluster" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//caas/kubernetes/cluster?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/caas/kubernetes/ingress/vts/README.md b/caas/kubernetes/ingress/vts/README.md index 9e12ad1..ffc144d 100644 --- a/caas/kubernetes/ingress/vts/README.md +++ b/caas/kubernetes/ingress/vts/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-caas-kubernetes-ingress-vts" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//caas/kubernetes/ingress/vts?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/caas/kubernetes/node/README.md b/caas/kubernetes/node/README.md index 85b4363..99bdb20 100644 --- a/caas/kubernetes/node/README.md +++ b/caas/kubernetes/node/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-caas-kubernetes-node" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//caas/kubernetes/node?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/caas/kubernetes/pod/README.md b/caas/kubernetes/pod/README.md index d2a72a0..1dbae32 100644 --- a/caas/kubernetes/pod/README.md +++ b/caas/kubernetes/pod/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-caas-kubernetes-pod" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//caas/kubernetes/pod?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/caas/kubernetes/workload/README.md b/caas/kubernetes/workload/README.md index 506622b..658cf2a 100644 --- a/caas/kubernetes/workload/README.md +++ b/caas/kubernetes/workload/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-caas-kubernetes-workload" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//caas/kubernetes/workload?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/alb/README.md b/cloud/aws/alb/README.md index 1486a09..cffe389 100644 --- a/cloud/aws/alb/README.md +++ b/cloud/aws/alb/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-alb" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/alb?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/apigateway/README.md b/cloud/aws/apigateway/README.md index 221ec17..dcf77da 100644 --- a/cloud/aws/apigateway/README.md +++ b/cloud/aws/apigateway/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-apigateway" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/apigateway?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/elasticache/common/README.md b/cloud/aws/elasticache/common/README.md index 11c445a..5eec859 100644 --- a/cloud/aws/elasticache/common/README.md +++ b/cloud/aws/elasticache/common/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-elasticache-common" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/elasticache/common?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/elasticache/memcached/README.md b/cloud/aws/elasticache/memcached/README.md index 5f6873e..36d903f 100644 --- a/cloud/aws/elasticache/memcached/README.md +++ b/cloud/aws/elasticache/memcached/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-elasticache-memcached" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/elasticache/memcached?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/elasticache/redis/README.md b/cloud/aws/elasticache/redis/README.md index 8c85bde..2ee8c4a 100644 --- a/cloud/aws/elasticache/redis/README.md +++ b/cloud/aws/elasticache/redis/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-elasticache-redis" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/elasticache/redis?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/elasticsearch/README.md b/cloud/aws/elasticsearch/README.md index f0243a7..2c227fc 100644 --- a/cloud/aws/elasticsearch/README.md +++ b/cloud/aws/elasticsearch/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-elasticsearch" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/elasticsearch?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message es_cluster_volume_size = 42 } diff --git a/cloud/aws/elb/README.md b/cloud/aws/elb/README.md index 7c97a02..746a396 100644 --- a/cloud/aws/elb/README.md +++ b/cloud/aws/elb/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-elb" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/elb?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/kinesis-firehose/README.md b/cloud/aws/kinesis-firehose/README.md index ff48939..5cdf537 100644 --- a/cloud/aws/kinesis-firehose/README.md +++ b/cloud/aws/kinesis-firehose/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-kinesis-firehose" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/kinesis-firehose?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/rds/aurora/mysql/README.md b/cloud/aws/rds/aurora/mysql/README.md index 75e1bc8..fca0f08 100644 --- a/cloud/aws/rds/aurora/mysql/README.md +++ b/cloud/aws/rds/aurora/mysql/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-rds-aurora-mysql" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/rds/aurora/mysql?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/rds/aurora/postgresql/README.md b/cloud/aws/rds/aurora/postgresql/README.md index c0086a8..75eb888 100644 --- a/cloud/aws/rds/aurora/postgresql/README.md +++ b/cloud/aws/rds/aurora/postgresql/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-rds-aurora-postgresql" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/rds/aurora/postgresql?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/rds/common/README.md b/cloud/aws/rds/common/README.md index 0b34ec2..1a130b8 100644 --- a/cloud/aws/rds/common/README.md +++ b/cloud/aws/rds/common/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-rds-common" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/rds/common?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/aws/vpn/README.md b/cloud/aws/vpn/README.md index 40ef56b..43b1e44 100644 --- a/cloud/aws/vpn/README.md +++ b/cloud/aws/vpn/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-aws-vpn" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/aws/vpn?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/apimanagement/README.md b/cloud/azure/apimanagement/README.md index 2f1bf32..f302ea8 100644 --- a/cloud/azure/apimanagement/README.md +++ b/cloud/azure/apimanagement/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-apimanagement" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/apimanagement?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/app-services/README.md b/cloud/azure/app-services/README.md index 5ad719b..5d50cb1 100644 --- a/cloud/azure/app-services/README.md +++ b/cloud/azure/app-services/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-app-services" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/app-services?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/azure-search/README.md b/cloud/azure/azure-search/README.md index 2f42682..8810363 100644 --- a/cloud/azure/azure-search/README.md +++ b/cloud/azure/azure-search/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-azure-search" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/azure-search?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/cosmosdb/README.md b/cloud/azure/cosmosdb/README.md index 11d4eba..f145b06 100644 --- a/cloud/azure/cosmosdb/README.md +++ b/cloud/azure/cosmosdb/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-cosmosdb" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/cosmosdb?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/datalakestore/README.md b/cloud/azure/datalakestore/README.md index f5d2d9d..7a927af 100644 --- a/cloud/azure/datalakestore/README.md +++ b/cloud/azure/datalakestore/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-datalakestore" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/datalakestore?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/eventgrid/README.md b/cloud/azure/eventgrid/README.md index 6258409..53319c2 100644 --- a/cloud/azure/eventgrid/README.md +++ b/cloud/azure/eventgrid/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-eventgrid" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/eventgrid?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/eventhub/README.md b/cloud/azure/eventhub/README.md index 5d3f281..935998f 100644 --- a/cloud/azure/eventhub/README.md +++ b/cloud/azure/eventhub/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-eventhub" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/eventhub?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/functions/README.md b/cloud/azure/functions/README.md index 3f441ad..ab5a674 100644 --- a/cloud/azure/functions/README.md +++ b/cloud/azure/functions/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-functions" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/functions?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/iothubs/README.md b/cloud/azure/iothubs/README.md index 873bc51..fcc2c21 100644 --- a/cloud/azure/iothubs/README.md +++ b/cloud/azure/iothubs/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-iothubs" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/iothubs?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/keyvault/README.md b/cloud/azure/keyvault/README.md index 56ff10c..d9735ca 100644 --- a/cloud/azure/keyvault/README.md +++ b/cloud/azure/keyvault/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-keyvault" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/keyvault?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/load-balancer/README.md b/cloud/azure/load-balancer/README.md index a197b6b..3933000 100644 --- a/cloud/azure/load-balancer/README.md +++ b/cloud/azure/load-balancer/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-load-balancer" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/load-balancer?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/mysql/README.md b/cloud/azure/mysql/README.md index 1380a8e..fecb50c 100644 --- a/cloud/azure/mysql/README.md +++ b/cloud/azure/mysql/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-mysql" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/mysql?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/postgresql/README.md b/cloud/azure/postgresql/README.md index 5da0a26..86bbc5b 100644 --- a/cloud/azure/postgresql/README.md +++ b/cloud/azure/postgresql/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-postgresql" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/postgresql?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/redis/README.md b/cloud/azure/redis/README.md index 910a742..6f4d94c 100644 --- a/cloud/azure/redis/README.md +++ b/cloud/azure/redis/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-redis" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/redis?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/serverfarms/README.md b/cloud/azure/serverfarms/README.md index d56c812..973460e 100644 --- a/cloud/azure/serverfarms/README.md +++ b/cloud/azure/serverfarms/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-serverfarms" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/serverfarms?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/servicebus/README.md b/cloud/azure/servicebus/README.md index 2d87c91..8a239e4 100644 --- a/cloud/azure/servicebus/README.md +++ b/cloud/azure/servicebus/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-servicebus" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/servicebus?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/sql-database/README.md b/cloud/azure/sql-database/README.md index 1e7af34..42d19c2 100644 --- a/cloud/azure/sql-database/README.md +++ b/cloud/azure/sql-database/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-sql-database" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/sql-database?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/sql-elasticpool/README.md b/cloud/azure/sql-elasticpool/README.md index d27a751..a6f1ebb 100644 --- a/cloud/azure/sql-elasticpool/README.md +++ b/cloud/azure/sql-elasticpool/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-sql-elasticpool" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/sql-elasticpool?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/storage/README.md b/cloud/azure/storage/README.md index a693665..c031622 100644 --- a/cloud/azure/storage/README.md +++ b/cloud/azure/storage/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-storage" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/storage?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/stream-analytics/README.md b/cloud/azure/stream-analytics/README.md index 035317b..3b913be 100644 --- a/cloud/azure/stream-analytics/README.md +++ b/cloud/azure/stream-analytics/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-stream-analytics" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/stream-analytics?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/azure/virtual-machine/README.md b/cloud/azure/virtual-machine/README.md index ff174bb..77f5b2f 100644 --- a/cloud/azure/virtual-machine/README.md +++ b/cloud/azure/virtual-machine/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-azure-virtual-machine" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/azure/virtual-machine?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/gcp/big-query/README.md b/cloud/gcp/big-query/README.md index e0de308..49ca366 100644 --- a/cloud/gcp/big-query/README.md +++ b/cloud/gcp/big-query/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-gcp-big-query" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/gcp/big-query?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/gcp/cloud-sql/common/README.md b/cloud/gcp/cloud-sql/common/README.md index 4c63fe1..186d4dc 100644 --- a/cloud/gcp/cloud-sql/common/README.md +++ b/cloud/gcp/cloud-sql/common/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-gcp-cloud-sql-common" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/gcp/cloud-sql/common?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/gcp/cloud-sql/mysql/README.md b/cloud/gcp/cloud-sql/mysql/README.md index 1e0f455..8663118 100644 --- a/cloud/gcp/cloud-sql/mysql/README.md +++ b/cloud/gcp/cloud-sql/mysql/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-gcp-cloud-sql-mysql" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/gcp/cloud-sql/mysql?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/gcp/gce/instance/README.md b/cloud/gcp/gce/instance/README.md index a5f0cbf..ad30770 100644 --- a/cloud/gcp/gce/instance/README.md +++ b/cloud/gcp/gce/instance/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-gcp-gce-instance" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/gcp/gce/instance?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/gcp/lb/README.md b/cloud/gcp/lb/README.md index 16dfdbb..304d8eb 100644 --- a/cloud/gcp/lb/README.md +++ b/cloud/gcp/lb/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-gcp-lb" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/gcp/lb?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/cloud/gcp/pubsub/README.md b/cloud/gcp/pubsub/README.md index bd1c6b8..a896b88 100644 --- a/cloud/gcp/pubsub/README.md +++ b/cloud/gcp/pubsub/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-cloud-gcp-pubsub" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//cloud/gcp/pubsub?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/database/elasticsearch/README.md b/database/elasticsearch/README.md index 4698bb0..751100a 100644 --- a/database/elasticsearch/README.md +++ b/database/elasticsearch/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-database-elasticsearch" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//database/elasticsearch?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/database/mongodb/README.md b/database/mongodb/README.md index 739ae84..8d526f4 100644 --- a/database/mongodb/README.md +++ b/database/mongodb/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-database-mongodb" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//database/mongodb?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/database/mysql/README.md b/database/mysql/README.md index 042ddc9..f894048 100644 --- a/database/mysql/README.md +++ b/database/mysql/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-database-mysql" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//database/mysql?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/database/postgresql/README.md b/database/postgresql/README.md index bf65649..729525b 100644 --- a/database/postgresql/README.md +++ b/database/postgresql/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-database-postgresql" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//database/postgresql?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/database/redis/README.md b/database/redis/README.md index 35873d3..7e41f80 100644 --- a/database/redis/README.md +++ b/database/redis/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-database-redis" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//database/redis?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/middleware/apache/README.md b/middleware/apache/README.md index 05749f5..b6fa5ef 100644 --- a/middleware/apache/README.md +++ b/middleware/apache/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-middleware-apache" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//middleware/apache?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/middleware/nginx/README.md b/middleware/nginx/README.md index ffaa68b..2f0e475 100644 --- a/middleware/nginx/README.md +++ b/middleware/nginx/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-middleware-nginx" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//middleware/nginx?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/middleware/php-fpm/README.md b/middleware/php-fpm/README.md index 0f27bb1..f5d7423 100644 --- a/middleware/php-fpm/README.md +++ b/middleware/php-fpm/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-middleware-php-fpm" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//middleware/php-fpm?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` diff --git a/system/generic/README.md b/system/generic/README.md index 11f632e..af09057 100644 --- a/system/generic/README.md +++ b/system/generic/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-system-generic" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//system/generic?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message memory_message = "${module.datadog-message-alerting-bh-only.alerting-message}" } diff --git a/system/unreachable/README.md b/system/unreachable/README.md index 09cdca3..197ee58 100644 --- a/system/unreachable/README.md +++ b/system/unreachable/README.md @@ -6,8 +6,8 @@ module "datadog-monitors-system-unreachable" { source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//system/unreachable?ref={revision}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + environment = var.environment + message = module.datadog-message-alerting.alerting-message } ``` From 513cf6eaebdfa8343bf080449b695594ca6c19f0 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Fri, 28 Jun 2019 01:02:59 +0200 Subject: [PATCH 17/26] MON-459 fix missing threshold_windows on anomaly monitors --- database/elasticsearch/monitors-elasticsearch.tf | 5 +++++ database/mysql/monitors-mysql.tf | 10 ++++++++++ 2 files changed, 15 insertions(+) diff --git a/database/elasticsearch/monitors-elasticsearch.tf b/database/elasticsearch/monitors-elasticsearch.tf index 99fbd90..5f011e7 100644 --- a/database/elasticsearch/monitors-elasticsearch.tf +++ b/database/elasticsearch/monitors-elasticsearch.tf @@ -437,6 +437,11 @@ warning = var.http_connections_anomaly_threshold_warning critical = var.http_connections_anomaly_threshold_critical } +threshold_windows = { +trigger_window = var.http_connections_anomaly_alert_window +recovery_window = var.http_connections_anomaly_alert_window +} + evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_audit = false diff --git a/database/mysql/monitors-mysql.tf b/database/mysql/monitors-mysql.tf index 6b5e95e..6ce177b 100644 --- a/database/mysql/monitors-mysql.tf +++ b/database/mysql/monitors-mysql.tf @@ -198,6 +198,11 @@ critical = var.mysql_threads_threshold_critical critical_recovery = 0 } +threshold_windows = { +trigger_window = var.mysql_threads_alert_window +recovery_window = var.mysql_threads_alert_window +} + evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false @@ -235,6 +240,11 @@ EOQ critical_recovery = 0 } + threshold_windows = { + trigger_window = var.mysql_questions_alert_window + recovery_window = var.mysql_questions_alert_window + } + evaluation_delay = var.evaluation_delay new_host_delay = var.new_host_delay notify_no_data = false From d276f2827ae6e04d526cc3e3a44ee77841aee614 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Tue, 2 Jul 2019 21:08:34 +0200 Subject: [PATCH 18/26] MON-456 fix cloud sql readme --- cloud/gcp/cloud-sql/common/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/cloud/gcp/cloud-sql/common/README.md b/cloud/gcp/cloud-sql/common/README.md index 186d4dc..6916d06 100644 --- a/cloud/gcp/cloud-sql/common/README.md +++ b/cloud/gcp/cloud-sql/common/README.md @@ -17,6 +17,7 @@ module "datadog-monitors-cloud-gcp-cloud-sql-common" { Creates DataDog monitors with the following checks: - Cloud SQL CPU Utilization +- Cloud SQL Failover Unavailable - Cloud SQL Memory Utilization - Cloud SQL Disk Utilization - Cloud SQL Memory Utilization forecast @@ -32,8 +33,6 @@ Creates DataDog monitors with the following checks: | cpu\_utilization\_threshold\_warning | CPU Utilization in percentage (warning threshold) | string | `"80"` | no | | cpu\_utilization\_time\_aggregator | Time aggregator for the CPU Utilization monitor | string | `"avg"` | no | | cpu\_utilization\_timeframe | Timeframe for the CPU Utilization monitor | string | `"last_15m"` | no | -| datadog\_api\_key | | string | `"xxx"` | no | -| datadog\_app\_key | | string | `"yyy"` | no | | disk\_utilization\_enabled | Flag to enable GCP Cloud SQL Disk Utilization monitor | string | `"true"` | no | | disk\_utilization\_extra\_tags | Extra tags for GCP Cloud SQL CPU Utilization monitor | list(string) | `[]` | no | | disk\_utilization\_forecast\_algorithm | Algorithm for the Disk Utilization Forecast monitor | string | `"linear"` | no | From 6acdc52f7b9a043e570deee1de39eb3e90c2a782 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 3 Jul 2019 09:21:52 +0200 Subject: [PATCH 19/26] MON-459 remove trailing newlines --- cloud/aws/elasticache/redis/monitors-redis.tf | 1 - database/elasticsearch/monitors-elasticsearch.tf | 1 - 2 files changed, 2 deletions(-) diff --git a/cloud/aws/elasticache/redis/monitors-redis.tf b/cloud/aws/elasticache/redis/monitors-redis.tf index 25483b7..22aab16 100644 --- a/cloud/aws/elasticache/redis/monitors-redis.tf +++ b/cloud/aws/elasticache/redis/monitors-redis.tf @@ -91,7 +91,6 @@ name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment message = coalesce(var.commands_message, var.message) type = "query alert" - query = < Date: Wed, 3 Jul 2019 10:52:23 +0200 Subject: [PATCH 20/26] MON-459 homogenize tags --- cloud/azure/servicebus/monitors-service-bus.tf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cloud/azure/servicebus/monitors-service-bus.tf b/cloud/azure/servicebus/monitors-service-bus.tf index f92564b..3da9b9f 100644 --- a/cloud/azure/servicebus/monitors-service-bus.tf +++ b/cloud/azure/servicebus/monitors-service-bus.tf @@ -45,7 +45,7 @@ include_tags = true locked = false require_full_window = false -tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"], var.no_active_connections_extra_tags) +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.no_active_connections_extra_tags) } resource "datadog_monitor" "service_bus_user_errors" { @@ -76,7 +76,7 @@ include_tags = true locked = false require_full_window = false -tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"], var.user_errors_extra_tags) +tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.user_errors_extra_tags) } resource "datadog_monitor" "service_bus_server_errors" { @@ -107,6 +107,6 @@ EOQ locked = false require_full_window = false - tags = concat(["env:${var.environment}", "resource:servicebus", "team:azure", "provider:azure"], var.server_errors_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.server_errors_extra_tags) } From 4a3f7dbb2361a199ebd2e754bd86edcdf0e27312 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 3 Jul 2019 14:19:08 +0200 Subject: [PATCH 21/26] MON-459 delete auto created versions.tf --- caas/kubernetes/ark/versions.tf | 4 ---- caas/kubernetes/cluster/versions.tf | 4 ---- caas/kubernetes/ingress/vts/versions.tf | 4 ---- caas/kubernetes/node/versions.tf | 4 ---- caas/kubernetes/pod/versions.tf | 4 ---- caas/kubernetes/workload/versions.tf | 4 ---- cloud/aws/alb/versions.tf | 4 ---- cloud/aws/apigateway/versions.tf | 4 ---- cloud/aws/elasticache/common/versions.tf | 4 ---- cloud/aws/elasticache/memcached/versions.tf | 4 ---- cloud/aws/elasticache/redis/versions.tf | 4 ---- cloud/aws/elasticsearch/versions.tf | 4 ---- cloud/aws/elb/versions.tf | 4 ---- cloud/aws/kinesis-firehose/versions.tf | 4 ---- cloud/aws/rds/aurora/mysql/versions.tf | 4 ---- cloud/aws/rds/aurora/postgresql/versions.tf | 4 ---- cloud/aws/rds/common/versions.tf | 4 ---- cloud/aws/vpn/versions.tf | 4 ---- cloud/azure/apimanagement/versions.tf | 4 ---- cloud/azure/app-services/versions.tf | 4 ---- cloud/azure/azure-search/versions.tf | 4 ---- cloud/azure/cosmosdb/versions.tf | 4 ---- cloud/azure/datalakestore/versions.tf | 4 ---- cloud/azure/eventgrid/versions.tf | 4 ---- cloud/azure/eventhub/versions.tf | 4 ---- cloud/azure/functions/versions.tf | 4 ---- cloud/azure/iothubs/versions.tf | 4 ---- cloud/azure/keyvault/versions.tf | 4 ---- cloud/azure/load-balancer/versions.tf | 4 ---- cloud/azure/mysql/versions.tf | 4 ---- cloud/azure/postgresql/versions.tf | 4 ---- cloud/azure/redis/versions.tf | 4 ---- cloud/azure/serverfarms/versions.tf | 4 ---- cloud/azure/servicebus/versions.tf | 4 ---- cloud/azure/sql-database/versions.tf | 4 ---- cloud/azure/sql-elasticpool/versions.tf | 4 ---- cloud/azure/storage/versions.tf | 4 ---- cloud/azure/stream-analytics/versions.tf | 4 ---- cloud/azure/virtual-machine/versions.tf | 4 ---- cloud/gcp/big-query/versions.tf | 4 ---- cloud/gcp/cloud-sql/common/versions.tf | 4 ---- cloud/gcp/cloud-sql/mysql/versions.tf | 4 ---- cloud/gcp/gce/instance/versions.tf | 4 ---- cloud/gcp/lb/versions.tf | 4 ---- cloud/gcp/pubsub/versions.tf | 4 ---- common/alerting-message/versions.tf | 4 ---- common/filter-tags/versions.tf | 4 ---- database/elasticsearch/versions.tf | 4 ---- database/mongodb/versions.tf | 4 ---- database/mysql/versions.tf | 4 ---- database/postgresql/versions.tf | 4 ---- database/redis/versions.tf | 4 ---- middleware/apache/versions.tf | 4 ---- middleware/nginx/versions.tf | 4 ---- middleware/php-fpm/versions.tf | 4 ---- system/generic/versions.tf | 4 ---- system/unreachable/versions.tf | 4 ---- 57 files changed, 228 deletions(-) delete mode 100644 caas/kubernetes/ark/versions.tf delete mode 100644 caas/kubernetes/cluster/versions.tf delete mode 100644 caas/kubernetes/ingress/vts/versions.tf delete mode 100644 caas/kubernetes/node/versions.tf delete mode 100644 caas/kubernetes/pod/versions.tf delete mode 100644 caas/kubernetes/workload/versions.tf delete mode 100644 cloud/aws/alb/versions.tf delete mode 100644 cloud/aws/apigateway/versions.tf delete mode 100644 cloud/aws/elasticache/common/versions.tf delete mode 100644 cloud/aws/elasticache/memcached/versions.tf delete mode 100644 cloud/aws/elasticache/redis/versions.tf delete mode 100644 cloud/aws/elasticsearch/versions.tf delete mode 100644 cloud/aws/elb/versions.tf delete mode 100644 cloud/aws/kinesis-firehose/versions.tf delete mode 100644 cloud/aws/rds/aurora/mysql/versions.tf delete mode 100644 cloud/aws/rds/aurora/postgresql/versions.tf delete mode 100644 cloud/aws/rds/common/versions.tf delete mode 100644 cloud/aws/vpn/versions.tf delete mode 100644 cloud/azure/apimanagement/versions.tf delete mode 100644 cloud/azure/app-services/versions.tf delete mode 100644 cloud/azure/azure-search/versions.tf delete mode 100644 cloud/azure/cosmosdb/versions.tf delete mode 100644 cloud/azure/datalakestore/versions.tf delete mode 100644 cloud/azure/eventgrid/versions.tf delete mode 100644 cloud/azure/eventhub/versions.tf delete mode 100644 cloud/azure/functions/versions.tf delete mode 100644 cloud/azure/iothubs/versions.tf delete mode 100644 cloud/azure/keyvault/versions.tf delete mode 100644 cloud/azure/load-balancer/versions.tf delete mode 100644 cloud/azure/mysql/versions.tf delete mode 100644 cloud/azure/postgresql/versions.tf delete mode 100644 cloud/azure/redis/versions.tf delete mode 100644 cloud/azure/serverfarms/versions.tf delete mode 100644 cloud/azure/servicebus/versions.tf delete mode 100644 cloud/azure/sql-database/versions.tf delete mode 100644 cloud/azure/sql-elasticpool/versions.tf delete mode 100644 cloud/azure/storage/versions.tf delete mode 100644 cloud/azure/stream-analytics/versions.tf delete mode 100644 cloud/azure/virtual-machine/versions.tf delete mode 100644 cloud/gcp/big-query/versions.tf delete mode 100644 cloud/gcp/cloud-sql/common/versions.tf delete mode 100644 cloud/gcp/cloud-sql/mysql/versions.tf delete mode 100644 cloud/gcp/gce/instance/versions.tf delete mode 100644 cloud/gcp/lb/versions.tf delete mode 100644 cloud/gcp/pubsub/versions.tf delete mode 100644 common/alerting-message/versions.tf delete mode 100644 common/filter-tags/versions.tf delete mode 100644 database/elasticsearch/versions.tf delete mode 100644 database/mongodb/versions.tf delete mode 100644 database/mysql/versions.tf delete mode 100644 database/postgresql/versions.tf delete mode 100644 database/redis/versions.tf delete mode 100644 middleware/apache/versions.tf delete mode 100644 middleware/nginx/versions.tf delete mode 100644 middleware/php-fpm/versions.tf delete mode 100644 system/generic/versions.tf delete mode 100644 system/unreachable/versions.tf diff --git a/caas/kubernetes/ark/versions.tf b/caas/kubernetes/ark/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/caas/kubernetes/ark/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/caas/kubernetes/cluster/versions.tf b/caas/kubernetes/cluster/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/caas/kubernetes/cluster/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/caas/kubernetes/ingress/vts/versions.tf b/caas/kubernetes/ingress/vts/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/caas/kubernetes/ingress/vts/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/caas/kubernetes/node/versions.tf b/caas/kubernetes/node/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/caas/kubernetes/node/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/caas/kubernetes/pod/versions.tf b/caas/kubernetes/pod/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/caas/kubernetes/pod/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/caas/kubernetes/workload/versions.tf b/caas/kubernetes/workload/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/caas/kubernetes/workload/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/alb/versions.tf b/cloud/aws/alb/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/alb/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/apigateway/versions.tf b/cloud/aws/apigateway/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/apigateway/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/elasticache/common/versions.tf b/cloud/aws/elasticache/common/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/elasticache/common/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/elasticache/memcached/versions.tf b/cloud/aws/elasticache/memcached/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/elasticache/memcached/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/elasticache/redis/versions.tf b/cloud/aws/elasticache/redis/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/elasticache/redis/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/elasticsearch/versions.tf b/cloud/aws/elasticsearch/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/elasticsearch/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/elb/versions.tf b/cloud/aws/elb/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/elb/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/kinesis-firehose/versions.tf b/cloud/aws/kinesis-firehose/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/kinesis-firehose/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/rds/aurora/mysql/versions.tf b/cloud/aws/rds/aurora/mysql/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/rds/aurora/mysql/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/rds/aurora/postgresql/versions.tf b/cloud/aws/rds/aurora/postgresql/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/rds/aurora/postgresql/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/rds/common/versions.tf b/cloud/aws/rds/common/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/rds/common/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/aws/vpn/versions.tf b/cloud/aws/vpn/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/aws/vpn/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/apimanagement/versions.tf b/cloud/azure/apimanagement/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/apimanagement/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/app-services/versions.tf b/cloud/azure/app-services/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/app-services/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/azure-search/versions.tf b/cloud/azure/azure-search/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/azure-search/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/cosmosdb/versions.tf b/cloud/azure/cosmosdb/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/cosmosdb/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/datalakestore/versions.tf b/cloud/azure/datalakestore/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/datalakestore/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/eventgrid/versions.tf b/cloud/azure/eventgrid/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/eventgrid/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/eventhub/versions.tf b/cloud/azure/eventhub/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/eventhub/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/functions/versions.tf b/cloud/azure/functions/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/functions/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/iothubs/versions.tf b/cloud/azure/iothubs/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/iothubs/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/keyvault/versions.tf b/cloud/azure/keyvault/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/keyvault/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/load-balancer/versions.tf b/cloud/azure/load-balancer/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/load-balancer/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/mysql/versions.tf b/cloud/azure/mysql/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/mysql/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/postgresql/versions.tf b/cloud/azure/postgresql/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/postgresql/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/redis/versions.tf b/cloud/azure/redis/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/redis/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/serverfarms/versions.tf b/cloud/azure/serverfarms/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/serverfarms/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/servicebus/versions.tf b/cloud/azure/servicebus/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/servicebus/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/sql-database/versions.tf b/cloud/azure/sql-database/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/sql-database/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/sql-elasticpool/versions.tf b/cloud/azure/sql-elasticpool/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/sql-elasticpool/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/storage/versions.tf b/cloud/azure/storage/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/storage/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/stream-analytics/versions.tf b/cloud/azure/stream-analytics/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/stream-analytics/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/azure/virtual-machine/versions.tf b/cloud/azure/virtual-machine/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/azure/virtual-machine/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/gcp/big-query/versions.tf b/cloud/gcp/big-query/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/gcp/big-query/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/gcp/cloud-sql/common/versions.tf b/cloud/gcp/cloud-sql/common/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/gcp/cloud-sql/common/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/gcp/cloud-sql/mysql/versions.tf b/cloud/gcp/cloud-sql/mysql/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/gcp/cloud-sql/mysql/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/gcp/gce/instance/versions.tf b/cloud/gcp/gce/instance/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/gcp/gce/instance/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/gcp/lb/versions.tf b/cloud/gcp/lb/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/gcp/lb/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/cloud/gcp/pubsub/versions.tf b/cloud/gcp/pubsub/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/cloud/gcp/pubsub/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/common/alerting-message/versions.tf b/common/alerting-message/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/common/alerting-message/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/common/filter-tags/versions.tf b/common/filter-tags/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/common/filter-tags/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/database/elasticsearch/versions.tf b/database/elasticsearch/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/database/elasticsearch/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/database/mongodb/versions.tf b/database/mongodb/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/database/mongodb/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/database/mysql/versions.tf b/database/mysql/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/database/mysql/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/database/postgresql/versions.tf b/database/postgresql/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/database/postgresql/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/database/redis/versions.tf b/database/redis/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/database/redis/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/middleware/apache/versions.tf b/middleware/apache/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/middleware/apache/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/middleware/nginx/versions.tf b/middleware/nginx/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/middleware/nginx/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/middleware/php-fpm/versions.tf b/middleware/php-fpm/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/middleware/php-fpm/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/system/generic/versions.tf b/system/generic/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/system/generic/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} diff --git a/system/unreachable/versions.tf b/system/unreachable/versions.tf deleted file mode 100644 index ac97c6a..0000000 --- a/system/unreachable/versions.tf +++ /dev/null @@ -1,4 +0,0 @@ - -terraform { - required_version = ">= 0.12" -} From 1d8d96ce292de1853f56fc8904332859aff2ca2f Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 3 Jul 2019 18:20:28 +0200 Subject: [PATCH 22/26] MON-459 hack to bypass fmt bug with here doc --- scripts/99_terraform.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/99_terraform.sh b/scripts/99_terraform.sh index 3abb356..786abf7 100755 --- a/scripts/99_terraform.sh +++ b/scripts/99_terraform.sh @@ -31,6 +31,11 @@ EOF terraform init ${dir} terraform validate ${dir} rm -f ${dir}/tmp.tf + # hack to work around bug https://github.com/hashicorp/terraform/issues/21434 + # TODO when fixed, remove this bloc and add "terraform fmt -recursive" to the end of this file + for file in $(grep ' = < Date: Wed, 3 Jul 2019 18:22:24 +0200 Subject: [PATCH 23/26] MON-459 apply hack for fmt --- caas/kubernetes/ark/monitors-ark.tf | 18 +- .../cluster/monitors-k8s-cluster.tf | 16 +- .../ingress/vts/monitors-ingress.tf | 56 +- caas/kubernetes/node/monitors-k8s-node.tf | 226 ++++---- caas/kubernetes/pod/monitors-k8s-pod.tf | 52 +- .../workload/monitors-k8s-workload.tf | 106 ++-- cloud/aws/alb/monitors-alb.tf | 132 ++--- cloud/aws/apigateway/monitors-api.tf | 80 +-- .../common/monitors-elasticache.tf | 136 ++--- .../memcached/monitors-memcached.tf | 56 +- cloud/aws/elasticache/redis/monitors-redis.tf | 88 ++-- .../elasticsearch/monitors-elasticsearch.tf | 92 ++-- cloud/aws/elb/monitors-elb.tf | 152 +++--- .../monitors-kinesis-firehose.tf | 16 +- .../aurora/mysql/monitors-rds-aurora-mysql.tf | 16 +- .../monitors-rds-aurora-postgresql.tf | 16 +- cloud/aws/rds/common/monitors-rds-common.tf | 86 ++-- cloud/aws/vpn/monitors-vpn.tf | 14 +- .../monitors-azure-apimanagement.tf | 112 ++-- .../app-services/monitors-app_services.tf | 128 ++--- .../azure-search/monitors-azure-search.tf | 48 +- cloud/azure/cosmosdb/monitors-cosmosdb.tf | 96 ++-- .../datalakestore/monitors-datalakestore.tf | 16 +- cloud/azure/eventgrid/monitors-eventgrid.tf | 90 ++-- cloud/azure/eventhub/monitors-eventhub.tf | 90 ++-- cloud/azure/functions/monitors-functions.tf | 80 +-- cloud/azure/iothubs/monitors-iothubs.tf | 330 ++++++------ cloud/azure/keyvault/monitors-keyvault.tf | 90 ++-- .../load-balancer/monitors-load-balancer.tf | 16 +- cloud/azure/mysql/monitors-mysql.tf | 96 ++-- .../azure/postgresql/monitors-postegresql.tf | 106 ++-- cloud/azure/redis/monitors-azure-redis.tf | 94 ++-- .../serverfarms/monitors-azure-serverfarms.tf | 90 ++-- .../azure/servicebus/monitors-service-bus.tf | 86 ++-- .../sql-database/monitors-sql-database.tf | 110 ++-- .../monitors-sql-elasticpool.tf | 92 ++-- cloud/azure/storage/monitors-azure-storage.tf | 210 ++++---- .../monitors-stream-analytics.tf | 112 ++-- .../monitors-virtual-machine.tf | 90 ++-- cloud/gcp/big-query/monitors-big-query.tf | 210 ++++---- .../common/monitors-cloud-sql-common.tf | 158 +++--- .../mysql/monitors-cloudsql-mysql.tf | 18 +- .../gcp/gce/instance/monitors-gce-instance.tf | 92 ++-- cloud/gcp/lb/monitors-lb.tf | 114 ++-- cloud/gcp/pubsub/monitors-pubsub.tf | 54 +- common/alerting-message/main.tf | 8 +- .../elasticsearch/monitors-elasticsearch.tf | 486 +++++++++--------- database/mongodb/monitors-mongo.tf | 88 ++-- database/mysql/monitors-mysql.tf | 180 +++---- database/postgresql/monitors-postgresql.tf | 84 +-- database/redis/monitors-redis.tf | 248 ++++----- middleware/apache/monitors-apache.tf | 16 +- middleware/nginx/monitors-nginx.tf | 52 +- middleware/php-fpm/monitors-fpm.tf | 54 +- system/generic/monitors-system.tf | 144 +++--- system/unreachable/monitors-unreachable.tf | 18 +- 56 files changed, 2782 insertions(+), 2782 deletions(-) diff --git a/caas/kubernetes/ark/monitors-ark.tf b/caas/kubernetes/ark/monitors-ark.tf index 94039ab..1e91228 100644 --- a/caas/kubernetes/ark/monitors-ark.tf +++ b/caas/kubernetes/ark/monitors-ark.tf @@ -10,19 +10,19 @@ EOQ thresholds = { critical = 1 - warning = 0 + warning = 0 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay no_data_timeframe = var.ark_schedules_monitor_no_data_timeframe - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:ark", "team:claranet", "created-by:terraform"], var.ark_schedules_extra_tags) diff --git a/caas/kubernetes/cluster/monitors-k8s-cluster.tf b/caas/kubernetes/cluster/monitors-k8s-cluster.tf index f5a8fbc..f6f9406 100644 --- a/caas/kubernetes/cluster/monitors-k8s-cluster.tf +++ b/caas/kubernetes/cluster/monitors-k8s-cluster.tf @@ -10,17 +10,17 @@ resource "datadog_monitor" "apiserver" { EOQ thresholds = { - warning = var.apiserver_threshold_warning + warning = var.apiserver_threshold_warning critical = 5 } - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.apiserver_extra_tags) diff --git a/caas/kubernetes/ingress/vts/monitors-ingress.tf b/caas/kubernetes/ingress/vts/monitors-ingress.tf index ebdecf1..811a129 100644 --- a/caas/kubernetes/ingress/vts/monitors-ingress.tf +++ b/caas/kubernetes/ingress/vts/monitors-ingress.tf @@ -12,28 +12,28 @@ resource "datadog_monitor" "nginx_ingress_too_many_5xx" { EOQ thresholds = { - warning = var.ingress_5xx_threshold_warning + warning = var.ingress_5xx_threshold_warning critical = var.ingress_5xx_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_5xx_extra_tags) } resource "datadog_monitor" "nginx_ingress_too_many_4xx" { - count = var.ingress_4xx_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Nginx Ingress 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.ingress_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Nginx Ingress 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.ingress_4xx_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.ingress_4xx_threshold_critical} EOQ -thresholds = { -warning = var.ingress_4xx_threshold_warning -critical = var.ingress_4xx_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_4xx_extra_tags) + thresholds = { + warning = var.ingress_4xx_threshold_warning + critical = var.ingress_4xx_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:caas", "provider:prometheus", "resource:nginx-ingress-controller", "team:claranet", "created-by:terraform"], var.ingress_4xx_extra_tags) } diff --git a/caas/kubernetes/node/monitors-k8s-node.tf b/caas/kubernetes/node/monitors-k8s-node.tf index cd2af34..b60f729 100644 --- a/caas/kubernetes/node/monitors-k8s-node.tf +++ b/caas/kubernetes/node/monitors-k8s-node.tf @@ -9,81 +9,81 @@ resource "datadog_monitor" "disk_pressure" { EOQ thresholds = { - warning = var.disk_pressure_threshold_warning + warning = var.disk_pressure_threshold_warning critical = 5 } - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.disk_pressure_extra_tags) } resource "datadog_monitor" "disk_out" { - count = var.disk_out_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node Out of disk" + count = var.disk_out_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node Out of disk" message = coalesce(var.disk_out_message, var.message) - type = "service check" + type = "service check" query = < ${var.unregister_net_device_threshold_critical} EOQ -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false -tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.unregister_net_device_extra_tags) + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.unregister_net_device_extra_tags) } resource "datadog_monitor" "node_unschedulable" { -count = var.node_unschedulable_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node unschedulable" -message = coalesce(var.node_unschedulable_message, var.message) -type = "metric alert" + count = var.node_unschedulable_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Node unschedulable" + message = coalesce(var.node_unschedulable_message, var.message) + type = "metric alert" query = < ${var.volume_inodes_threshold_critical} EOQ -thresholds = { -critical = var.volume_inodes_threshold_critical -warning = var.volume_inodes_threshold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.volume_inodes_extra_tags) + thresholds = { + critical = var.volume_inodes_threshold_critical + warning = var.volume_inodes_threshold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-node", "team:claranet", "created-by:terraform"], var.volume_inodes_extra_tags) } diff --git a/caas/kubernetes/pod/monitors-k8s-pod.tf b/caas/kubernetes/pod/monitors-k8s-pod.tf index c6e1898..ab5154c 100644 --- a/caas/kubernetes/pod/monitors-k8s-pod.tf +++ b/caas/kubernetes/pod/monitors-k8s-pod.tf @@ -14,24 +14,24 @@ EOQ } evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay + new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform"], var.pod_phase_status_extra_tags) } resource "datadog_monitor" "error" { - count = var.error_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Pod waiting errors" + count = var.error_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes Pod waiting errors" message = coalesce(var.error_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.error_threshold_critical} EOQ -thresholds = { -critical = var.error_threshold_critical -warning = var.error_threshold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform"], var.error_extra_tags) + thresholds = { + critical = var.error_threshold_critical + warning = var.error_threshold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-pod", "team:claranet", "created-by:terraform"], var.error_extra_tags) } diff --git a/caas/kubernetes/workload/monitors-k8s-workload.tf b/caas/kubernetes/workload/monitors-k8s-workload.tf index 88a6777..60308b8 100644 --- a/caas/kubernetes/workload/monitors-k8s-workload.tf +++ b/caas/kubernetes/workload/monitors-k8s-workload.tf @@ -9,54 +9,54 @@ resource "datadog_monitor" "job" { EOQ thresholds = { - warning = var.job_threshold_warning + warning = var.job_threshold_warning critical = 5 } - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:caas", "provider:kubernetes", "resource:kubernetes-workload", "team:claranet", "created-by:terraform"], var.job_extra_tags) } resource "datadog_monitor" "cronjob" { - count = var.cronjob_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes cronjob scheduling failed" + count = var.cronjob_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Kubernetes cronjob scheduling failed" message = coalesce(var.cronjob_message, var.message) - type = "service check" + type = "service check" query = < ${var.latency_threshold_critical} EOQ -thresholds = { -critical = var.latency_threshold_critical -warning = var.latency_threshold_warning -} + thresholds = { + critical = var.latency_threshold_critical + warning = var.latency_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.latency_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } resource "datadog_monitor" "ALB_httpcode_5xx" { -count = var.httpcode_alb_5xx_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 5xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.httpcode_alb_5xx_message, var.message) -type = "query alert" + count = var.httpcode_alb_5xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 5xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.httpcode_alb_5xx_message, var.message) + type = "query alert" query = < ${var.httpcode_alb_5xx_threshold_critical} EOQ -thresholds = { -critical = var.httpcode_alb_5xx_threshold_critical -warning = var.httpcode_alb_5xx_threshold_warning -} + thresholds = { + critical = var.httpcode_alb_5xx_threshold_critical + warning = var.httpcode_alb_5xx_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_alb_5xx_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_alb_5xx_extra_tags) } resource "datadog_monitor" "ALB_httpcode_4xx" { -count = var.httpcode_alb_4xx_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 4xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.httpcode_alb_4xx_message, var.message) -type = "query alert" + count = var.httpcode_alb_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ALB HTTP code 4xx {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.httpcode_alb_4xx_message, var.message) + type = "query alert" query = < ${var.httpcode_target_4xx_threshold_critical} EOQ -thresholds = { -critical = var.httpcode_target_4xx_threshold_critical -warning = var.httpcode_target_4xx_threshold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_target_4xx_extra_tags) + thresholds = { + critical = var.httpcode_target_4xx_threshold_critical + warning = var.httpcode_target_4xx_threshold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:alb", "team:claranet", "created-by:terraform"], var.httpcode_target_4xx_extra_tags) } diff --git a/cloud/aws/apigateway/monitors-api.tf b/cloud/aws/apigateway/monitors-api.tf index 8d60e3f..d318f81 100644 --- a/cloud/aws/apigateway/monitors-api.tf +++ b/cloud/aws/apigateway/monitors-api.tf @@ -12,27 +12,27 @@ resource "datadog_monitor" "API_Gateway_latency" { EOQ thresholds = { - warning = var.latency_threshold_warning + warning = var.latency_threshold_warning critical = var.latency_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 require_full_window = false - timeout_h = 0 - include_tags = true + timeout_h = 0 + include_tags = true tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } # Monitoring API Gateway 5xx errors percent resource "datadog_monitor" "API_http_5xx_errors_count" { - count = var.http_5xx_requests_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.http_5xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.http_5xx_requests_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.http_5xx_requests_threshold_critical} EOQ -thresholds = { -warning = var.http_5xx_requests_threshold_warning -critical = var.http_5xx_requests_threshold_critical -} + thresholds = { + warning = var.http_5xx_requests_threshold_warning + critical = var.http_5xx_requests_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) } # Monitoring API Gateway 4xx errors percent resource "datadog_monitor" "API_http_4xx_errors_count" { -count = var.http_4xx_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.http_4xx_requests_message, var.message) -type = "query alert" + count = var.http_4xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Gateway HTTP 4xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.http_4xx_requests_message, var.message) + type = "query alert" query = < ${var.http_4xx_requests_threshold_critical} EOQ -thresholds = { -warning = var.http_4xx_requests_threshold_warning -critical = var.http_4xx_requests_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_4xx_requests_extra_tags) + thresholds = { + warning = var.http_4xx_requests_threshold_warning + critical = var.http_4xx_requests_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:apigateway", "team:claranet", "created-by:terraform"], var.http_4xx_requests_extra_tags) } diff --git a/cloud/aws/elasticache/common/monitors-elasticache.tf b/cloud/aws/elasticache/common/monitors-elasticache.tf index 149a361..c59fb54 100644 --- a/cloud/aws/elasticache/common/monitors-elasticache.tf +++ b/cloud/aws/elasticache/common/monitors-elasticache.tf @@ -11,28 +11,28 @@ resource "datadog_monitor" "elasticache_eviction" { EOQ thresholds = { - warning = var.eviction_threshold_warning + warning = var.eviction_threshold_warning critical = var.eviction_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.eviction_extra_tags) } resource "datadog_monitor" "elasticache_max_connection" { - count = var.max_connection_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache max connections reached {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" + count = var.max_connection_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache max connections reached {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" message = coalesce(var.max_connection_message, var.message) - type = "query alert" + type = "query alert" query = <= 65000 EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = true -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.max_connection_extra_tags) + tags = concat(["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" { -count = var.no_connection_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache connections {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" -message = coalesce(var.no_connection_message, var.message) -type = "query alert" + count = var.no_connection_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache connections {{#is_alert}}{{{comparator}}} {{threshold}} {{/is_alert}}" + message = coalesce(var.no_connection_message, var.message) + type = "query alert" query = < ${var.eviction_growing_threshold_critical} EOQ -thresholds = { -warning = var.eviction_growing_threshold_warning -critical = var.eviction_growing_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache", "team:claranet", "created-by:terraform"], var.eviction_growing_extra_tags) + thresholds = { + warning = var.eviction_growing_threshold_warning + critical = var.eviction_growing_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["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/monitors-memcached.tf b/cloud/aws/elasticache/memcached/monitors-memcached.tf index 558d6f4..4dcb3d0 100644 --- a/cloud/aws/elasticache/memcached/monitors-memcached.tf +++ b/cloud/aws/elasticache/memcached/monitors-memcached.tf @@ -13,28 +13,28 @@ resource "datadog_monitor" "memcached_get_hits" { EOQ thresholds = { - warning = var.get_hits_threshold_warning + warning = var.get_hits_threshold_warning critical = var.get_hits_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached"], var.get_hits_extra_tags) } resource "datadog_monitor" "memcached_cpu_high" { - count = var.cpu_high_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache memcached CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.cpu_high_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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) - type = "query alert" + type = "query alert" query = < ${var.cpu_high_threshold_critical} EOQ -thresholds = { -warning = var.cpu_high_threshold_warning -critical = var.cpu_high_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = true -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached"], var.cpu_high_extra_tags) + thresholds = { + warning = var.cpu_high_threshold_warning + critical = var.cpu_high_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-memcached", "team:claranet", "created-by:terraform", "engine:memcached"], var.cpu_high_extra_tags) } diff --git a/cloud/aws/elasticache/redis/monitors-redis.tf b/cloud/aws/elasticache/redis/monitors-redis.tf index 22aab16..c3bf595 100644 --- a/cloud/aws/elasticache/redis/monitors-redis.tf +++ b/cloud/aws/elasticache/redis/monitors-redis.tf @@ -13,28 +13,28 @@ resource "datadog_monitor" "redis_cache_hits" { EOQ thresholds = { - warning = var.cache_hits_threshold_warning + warning = var.cache_hits_threshold_warning critical = var.cache_hits_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.cache_hits_extra_tags) } resource "datadog_monitor" "redis_cpu_high" { - count = var.cpu_high_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.cpu_high_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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) - type = "query alert" + type = "query alert" query = < ${var.cpu_high_threshold_critical} EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = true -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.cpu_high_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.cpu_high_extra_tags) } resource "datadog_monitor" "redis_replication_lag" { -count = var.replication_lag_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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) -type = "query alert" + count = var.replication_lag_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${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) + type = "query alert" query = < ${var.replication_lag_threshold_critical} EOQ -thresholds = { -warning = var.replication_lag_threshold_warning -critical = var.replication_lag_threshold_critical -} + thresholds = { + warning = var.replication_lag_threshold_warning + critical = var.replication_lag_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.replication_lag_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticache-redis", "team:claranet", "created-by:terraform", "engine:redis"], var.replication_lag_extra_tags) } resource "datadog_monitor" "redis_commands" { -count = var.commands_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis is receiving no commands" -message = coalesce(var.commands_message, var.message) -type = "query alert" + count = var.commands_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticache redis is receiving no commands" + message = coalesce(var.commands_message, var.message) + type = "query alert" query = < ${var.cpu_threshold_critical} EOQ -thresholds = { -warning = var.cpu_threshold_warning -critical = var.cpu_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) + thresholds = { + warning = var.cpu_threshold_warning + critical = var.cpu_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } diff --git a/cloud/aws/elb/monitors-elb.tf b/cloud/aws/elb/monitors-elb.tf index ada02fa..aca05f2 100644 --- a/cloud/aws/elb/monitors-elb.tf +++ b/cloud/aws/elb/monitors-elb.tf @@ -14,27 +14,27 @@ EOQ thresholds = { critical = 1 - warning = 100 + warning = 100 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_no_healthy_instance_extra_tags) } resource "datadog_monitor" "ELB_too_much_4xx" { - count = var.elb_4xx_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.elb_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.elb_4xx_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.elb_4xx_threshold_critical} EOQ -thresholds = { -warning = var.elb_4xx_threshold_warning -critical = var.elb_4xx_threshold_critical -} + thresholds = { + warning = var.elb_4xx_threshold_warning + critical = var.elb_4xx_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_4xx_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_4xx_extra_tags) } resource "datadog_monitor" "ELB_too_much_5xx" { -count = var.elb_5xx_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.elb_5xx_message, var.message) -type = "query alert" + count = var.elb_5xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.elb_5xx_message, var.message) + type = "query alert" query = < ${var.elb_5xx_threshold_critical} EOQ -thresholds = { -warning = var.elb_5xx_threshold_warning -critical = var.elb_5xx_threshold_critical -} + thresholds = { + warning = var.elb_5xx_threshold_warning + critical = var.elb_5xx_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_5xx_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_5xx_extra_tags) } resource "datadog_monitor" "ELB_too_much_4xx_backend" { -count = var.elb_backend_4xx_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB backend 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.elb_backend_4xx_message, var.message) -type = "query alert" + count = var.elb_backend_4xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ELB backend 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.elb_backend_4xx_message, var.message) + type = "query alert" query = < ${var.elb_backend_latency_critical} EOQ -thresholds = { -warning = var.elb_backend_latency_warning -critical = var.elb_backend_latency_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_backend_latency_extra_tags) + thresholds = { + warning = var.elb_backend_latency_warning + critical = var.elb_backend_latency_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:elb", "team:claranet", "created-by:terraform"], var.elb_backend_latency_extra_tags) } diff --git a/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf b/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf index b7b4f2b..41faf73 100644 --- a/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf +++ b/cloud/aws/kinesis-firehose/monitors-kinesis-firehose.tf @@ -15,14 +15,14 @@ EOQ critical = 0 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:kinesis-firehose", "team:claranet", "created-by:terraform"], var.incoming_records_extra_tags) diff --git a/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf b/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf index 222fad6..9f2555f 100644 --- a/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf +++ b/cloud/aws/rds/aurora/mysql/monitors-rds-aurora-mysql.tf @@ -12,17 +12,17 @@ resource "datadog_monitor" "rds_aurora_mysql_replica_lag" { EOQ thresholds = { - warning = var.aurora_replicalag_threshold_warning + warning = var.aurora_replicalag_threshold_warning critical = var.aurora_replicalag_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-mysql", "team:claranet", "created-by:terraform"], var.aurora_replicalag_extra_tags) diff --git a/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf b/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf index 4e05f70..399c0ce 100644 --- a/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf +++ b/cloud/aws/rds/aurora/postgresql/monitors-rds-aurora-postgresql.tf @@ -12,17 +12,17 @@ resource "datadog_monitor" "rds_aurora_postgresql_replica_lag" { EOQ thresholds = { - warning = var.aurora_replicalag_threshold_warning + warning = var.aurora_replicalag_threshold_warning critical = var.aurora_replicalag_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds-aurora-postgresql", "team:claranet", "created-by:terraform"], var.aurora_replicalag_extra_tags) diff --git a/cloud/aws/rds/common/monitors-rds-common.tf b/cloud/aws/rds/common/monitors-rds-common.tf index 327f584..d8c7931 100644 --- a/cloud/aws/rds/common/monitors-rds-common.tf +++ b/cloud/aws/rds/common/monitors-rds-common.tf @@ -12,17 +12,17 @@ resource "datadog_monitor" "rds_cpu_90_15min" { EOQ thresholds = { - warning = var.cpu_threshold_warning + warning = var.cpu_threshold_warning critical = var.cpu_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) @@ -30,10 +30,10 @@ EOQ ### RDS instance free space monitor ### resource "datadog_monitor" "rds_free_space_low" { - count = var.diskspace_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] RDS instance free space {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.diskspace_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] RDS instance free space {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.diskspace_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.replicalag_threshold_critical} EOQ -thresholds = { -warning = var.replicalag_threshold_warning -critical = var.replicalag_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform"], var.replicalag_extra_tags) + thresholds = { + warning = var.replicalag_threshold_warning + critical = var.replicalag_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:rds", "team:claranet", "created-by:terraform"], var.replicalag_extra_tags) } diff --git a/cloud/aws/vpn/monitors-vpn.tf b/cloud/aws/vpn/monitors-vpn.tf index 56f380c..10480a3 100644 --- a/cloud/aws/vpn/monitors-vpn.tf +++ b/cloud/aws/vpn/monitors-vpn.tf @@ -10,13 +10,13 @@ resource "datadog_monitor" "VPN_status" { ) < 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:aws", "resource:vpn", "team:claranet", "created-by:terraform"], var.vpn_status_extra_tags) diff --git a/cloud/azure/apimanagement/monitors-azure-apimanagement.tf b/cloud/azure/apimanagement/monitors-azure-apimanagement.tf index 672f140..492c25b 100644 --- a/cloud/azure/apimanagement/monitors-azure-apimanagement.tf +++ b/cloud/azure/apimanagement/monitors-azure-apimanagement.tf @@ -12,24 +12,24 @@ EOQ critical = 1 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "apimgt_failed_requests" { - count = var.failed_requests_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.failed_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.failed_requests_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.failed_requests_threshold_critical} EOQ -thresholds = { -critical = var.failed_requests_threshold_critical -warning = var.failed_requests_threshold_warning -} + thresholds = { + critical = var.failed_requests_threshold_critical + warning = var.failed_requests_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.failed_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.failed_requests_extra_tags) } resource "datadog_monitor" "apimgt_other_requests" { -count = var.other_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many other requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.other_requests_message, var.message) -type = "query alert" + count = var.other_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many other requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.other_requests_message, var.message) + type = "query alert" query = < ${var.other_requests_threshold_critical} EOQ -thresholds = { -critical = var.other_requests_threshold_critical -warning = var.other_requests_threshold_warning -} + thresholds = { + critical = var.other_requests_threshold_critical + warning = var.other_requests_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.other_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:apimanagement", "team:claranet", "created-by:terraform"], var.other_requests_extra_tags) } resource "datadog_monitor" "apimgt_unauthorized_requests" { -count = var.unauthorized_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many unauthorized requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.unauthorized_requests_message, var.message) -type = "query alert" + count = var.unauthorized_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] API Management too many unauthorized requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.unauthorized_requests_message, var.message) + type = "query alert" query = < ${var.memory_usage_threshold_critical} EOQ -thresholds = { -warning = var.memory_usage_threshold_warning -critical = var.memory_usage_threshold_critical -} + thresholds = { + warning = var.memory_usage_threshold_warning + critical = var.memory_usage_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.memory_usage_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.memory_usage_extra_tags) } # Monitoring App Services 5xx errors percent resource "datadog_monitor" "appservices_http_5xx_errors_count" { -count = var.http_5xx_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.http_5xx_requests_message, var.message) -type = "query alert" + count = var.http_5xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 5xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.http_5xx_requests_message, var.message) + type = "query alert" query = < ${var.http_5xx_requests_threshold_critical} EOQ -thresholds = { -warning = var.http_5xx_requests_threshold_warning -critical = var.http_5xx_requests_threshold_critical -} + thresholds = { + warning = var.http_5xx_requests_threshold_warning + critical = var.http_5xx_requests_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:app-services", "team:claranet", "created-by:terraform"], var.http_5xx_requests_extra_tags) } # Monitoring App Services 4xx errors percent resource "datadog_monitor" "appservices_http_4xx_errors_count" { -count = var.http_4xx_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.http_4xx_requests_message, var.message) -type = "query alert" + count = var.http_4xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] App Services HTTP 4xx errors too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.http_4xx_requests_message, var.message) + type = "query alert" query = < ${var.throttled_queries_rate_threshold_critical} EOQ -thresholds = { -warning = var.throttled_queries_rate_threshold_warning -critical = var.throttled_queries_rate_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 0 -include_tags = true - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform"], var.throttled_queries_rate_extra_tags) + thresholds = { + warning = var.throttled_queries_rate_threshold_warning + critical = var.throttled_queries_rate_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 0 + include_tags = true + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure-search", "team:claranet", "created-by:terraform"], var.throttled_queries_rate_extra_tags) } diff --git a/cloud/azure/cosmosdb/monitors-cosmosdb.tf b/cloud/azure/cosmosdb/monitors-cosmosdb.tf index a55c99d..df3ed86 100644 --- a/cloud/azure/cosmosdb/monitors-cosmosdb.tf +++ b/cloud/azure/cosmosdb/monitors-cosmosdb.tf @@ -14,24 +14,24 @@ EOQ critical = 1 } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "cosmos_db_4xx_requests" { - count = var.cosmos_db_4xx_requests_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 4xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.cosmos_db_4xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 4xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.cosmos_db_4xx_requests_message, var.message) - type = "query alert" + type = "query alert" # List of available status codes : https://docs.microsoft.com/en-us/rest/api/cosmos-db/http-status-codes-for-cosmosdb query = < ${var.cosmos_db_4xx_request_rate_threshold_critical} EOQ -thresholds = { -critical = var.cosmos_db_4xx_request_rate_threshold_critical -warning = var.cosmos_db_4xx_request_rate_threshold_warning -} + thresholds = { + critical = var.cosmos_db_4xx_request_rate_threshold_critical + warning = var.cosmos_db_4xx_request_rate_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_4xx_request_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_4xx_request_extra_tags) } resource "datadog_monitor" "cosmos_db_5xx_requests" { -count = var.cosmos_db_5xx_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 5xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.cosmos_db_5xx_requests_message, var.message) -type = "query alert" + count = var.cosmos_db_5xx_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB 5xx requests rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.cosmos_db_5xx_requests_message, var.message) + type = "query alert" query = < ${var.cosmos_db_5xx_request_rate_threshold_critical} EOQ -thresholds = { -critical = var.cosmos_db_5xx_request_rate_threshold_critical -warning = var.cosmos_db_5xx_request_rate_threshold_warning -} + thresholds = { + critical = var.cosmos_db_5xx_request_rate_threshold_critical + warning = var.cosmos_db_5xx_request_rate_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_5xx_request_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:cosmos_db", "team:claranet", "created-by:terraform"], var.cosmos_db_5xx_request_rate_extra_tags) } resource "datadog_monitor" "cosmos_db_scaling" { -count = var.cosmos_db_scaling_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB max scaling reached for collection {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.cosmos_db_scaling_message, var.message) -type = "query alert" + count = var.cosmos_db_scaling_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cosmos DB max scaling reached for collection {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.cosmos_db_scaling_message, var.message) + type = "query alert" -# List of available status codes : https://docs.microsoft.com/en-us/rest/api/cosmos-db/http-status-codes-for-cosmosdb + # List of available status codes : https://docs.microsoft.com/en-us/rest/api/cosmos-db/http-status-codes-for-cosmosdb query = < ${var.failed_messages_rate_thresold_critical} EOQ -thresholds = { -critical = var.failed_messages_rate_thresold_critical -warning = var.failed_messages_rate_thresold_warning -} + thresholds = { + critical = var.failed_messages_rate_thresold_critical + warning = var.failed_messages_rate_thresold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.failed_messages_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.failed_messages_rate_extra_tags) } resource "datadog_monitor" "eventgrid_unmatched_events" { -count = var.unmatched_events_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Grid too many unmatched events {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.unmatched_events_rate_message, var.message) -type = "query alert" + count = var.unmatched_events_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Grid too many unmatched events {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.unmatched_events_rate_message, var.message) + type = "query alert" query = < ${var.unmatched_events_rate_thresold_critical} EOQ -thresholds = { -critical = var.unmatched_events_rate_thresold_critical -warning = var.unmatched_events_rate_thresold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.unmatched_events_rate_extra_tags) + thresholds = { + critical = var.unmatched_events_rate_thresold_critical + warning = var.unmatched_events_rate_thresold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventgrid", "team:claranet", "created-by:terraform"], var.unmatched_events_rate_extra_tags) } diff --git a/cloud/azure/eventhub/monitors-eventhub.tf b/cloud/azure/eventhub/monitors-eventhub.tf index 05c7209..aa2945b 100644 --- a/cloud/azure/eventhub/monitors-eventhub.tf +++ b/cloud/azure/eventhub/monitors-eventhub.tf @@ -10,24 +10,24 @@ resource "datadog_monitor" "eventhub_status" { ) != 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "eventhub_failed_requests" { - count = var.failed_requests_rate_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.failed_requests_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.failed_requests_rate_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.failed_requests_rate_thresold_critical} EOQ -thresholds = { -critical = var.failed_requests_rate_thresold_critical -warning = var.failed_requests_rate_thresold_warning -} + thresholds = { + critical = var.failed_requests_rate_thresold_critical + warning = var.failed_requests_rate_thresold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.failed_requests_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.failed_requests_rate_extra_tags) } resource "datadog_monitor" "eventhub_errors" { -count = var.errors_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.errors_rate_message, var.message) -type = "query alert" + count = var.errors_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Event Hub too many errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.errors_rate_message, var.message) + type = "query alert" query = < ${var.errors_rate_thresold_critical} EOQ -thresholds = { -critical = var.errors_rate_thresold_critical -warning = var.errors_rate_thresold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.errors_rate_extra_tags) + thresholds = { + critical = var.errors_rate_thresold_critical + warning = var.errors_rate_thresold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:eventhub", "team:claranet", "created-by:terraform"], var.errors_rate_extra_tags) } diff --git a/cloud/azure/functions/monitors-functions.tf b/cloud/azure/functions/monitors-functions.tf index 1860351..2d97cce 100644 --- a/cloud/azure/functions/monitors-functions.tf +++ b/cloud/azure/functions/monitors-functions.tf @@ -12,26 +12,26 @@ resource "datadog_monitor" "function_http_5xx_errors_rate" { EOQ thresholds = { - warning = var.http_5xx_errors_rate_threshold_warning + warning = var.http_5xx_errors_rate_threshold_warning critical = var.http_5xx_errors_rate_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 require_full_window = false - timeout_h = 1 - include_tags = true + timeout_h = 1 + include_tags = true tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.http_5xx_errors_rate_extra_tags) } resource "datadog_monitor" "function_high_connections_count" { - count = var.high_connections_count_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App connections count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + count = var.high_connections_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App connections count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" message = coalesce(var.high_connections_count_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.high_connections_count_threshold_critical} EOQ -thresholds = { -warning = var.high_connections_count_threshold_warning -critical = var.high_connections_count_threshold_critical -} + thresholds = { + warning = var.high_connections_count_threshold_warning + critical = var.high_connections_count_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_connections_count_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_connections_count_extra_tags) } resource "datadog_monitor" "function_high_threads_count" { -count = var.high_threads_count_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App threads count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.high_threads_count_message, var.message) -type = "query alert" + count = var.high_threads_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Function App threads count too high {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.high_threads_count_message, var.message) + type = "query alert" query = < ${var.high_threads_count_threshold_critical} EOQ -thresholds = { -warning = var.high_threads_count_threshold_warning -critical = var.high_threads_count_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = false -timeout_h = 1 -include_tags = true - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_threads_count_extra_tags) + thresholds = { + warning = var.high_threads_count_threshold_warning + critical = var.high_threads_count_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = false + timeout_h = 1 + include_tags = true + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:azure_functions", "team:claranet", "created-by:terraform"], var.high_threads_count_extra_tags) } diff --git a/cloud/azure/iothubs/monitors-iothubs.tf b/cloud/azure/iothubs/monitors-iothubs.tf index b55499e..ed1b3ee 100644 --- a/cloud/azure/iothubs/monitors-iothubs.tf +++ b/cloud/azure/iothubs/monitors-iothubs.tf @@ -14,28 +14,28 @@ resource "datadog_monitor" "too_many_jobs_failed" { EOQ thresholds = { - warning = var.failed_jobs_rate_threshold_warning + warning = var.failed_jobs_rate_threshold_warning critical = var.failed_jobs_rate_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 1 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_jobs_rate_extra_tags) } resource "datadog_monitor" "too_many_list_jobs_failed" { - count = var.failed_listjobs_rate_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many list_jobs failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.failed_listjobs_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many list_jobs failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.failed_listjobs_rate_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.failed_listjobs_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_listjobs_rate_threshold_warning -critical = var.failed_listjobs_rate_threshold_critical -} + thresholds = { + warning = var.failed_listjobs_rate_threshold_warning + critical = var.failed_listjobs_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_listjobs_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_listjobs_rate_extra_tags) } resource "datadog_monitor" "too_many_query_jobs_failed" { -count = var.failed_queryjobs_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many query_jobs failed {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.failed_queryjobs_rate_message, var.message) -type = "query alert" + count = var.failed_queryjobs_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many query_jobs failed {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_queryjobs_rate_message, var.message) + type = "query alert" query = < ${var.failed_queryjobs_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_queryjobs_rate_threshold_warning -critical = var.failed_queryjobs_rate_threshold_critical -} + thresholds = { + warning = var.failed_queryjobs_rate_threshold_warning + critical = var.failed_queryjobs_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_queryjobs_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_queryjobs_rate_extra_tags) } resource "datadog_monitor" "status" { -count = var.status_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub is down" -message = coalesce(var.status_message, var.message) -type = "query alert" + count = var.status_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub is down" + message = coalesce(var.status_message, var.message) + type = "query alert" query = < ${var.failed_c2d_methods_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_c2d_methods_rate_threshold_warning -critical = var.failed_c2d_methods_rate_threshold_critical -} + thresholds = { + warning = var.failed_c2d_methods_rate_threshold_warning + critical = var.failed_c2d_methods_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_methods_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_methods_rate_extra_tags) } resource "datadog_monitor" "too_many_c2d_twin_read_failed" { -count = var.failed_c2d_twin_read_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin read failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.failed_c2d_twin_read_rate_message, var.message) -type = "query alert" + count = var.failed_c2d_twin_read_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin read failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_c2d_twin_read_rate_message, var.message) + type = "query alert" query = < ${var.failed_c2d_twin_read_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_c2d_twin_read_rate_threshold_warning -critical = var.failed_c2d_twin_read_rate_threshold_critical -} + thresholds = { + warning = var.failed_c2d_twin_read_rate_threshold_warning + critical = var.failed_c2d_twin_read_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_twin_read_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_c2d_twin_read_rate_extra_tags) } resource "datadog_monitor" "too_many_c2d_twin_update_failed" { -count = var.failed_c2d_twin_update_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin update failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.failed_c2d_twin_update_rate_message, var.message) -type = "query alert" + count = var.failed_c2d_twin_update_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many c2d twin update failure {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_c2d_twin_update_rate_message, var.message) + type = "query alert" query = < ${var.failed_d2c_twin_update_rate_threshold_critical} EOQ -thresholds = { -warning = var.failed_d2c_twin_update_rate_threshold_warning -critical = var.failed_d2c_twin_update_rate_threshold_critical -} + thresholds = { + warning = var.failed_d2c_twin_update_rate_threshold_warning + critical = var.failed_d2c_twin_update_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_d2c_twin_update_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.failed_d2c_twin_update_rate_extra_tags) } resource "datadog_monitor" "too_many_d2c_telemetry_egress_dropped" { -count = var.dropped_d2c_telemetry_egress_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress dropped {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.dropped_d2c_telemetry_egress_message, var.message) -type = "query alert" + count = var.dropped_d2c_telemetry_egress_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress dropped {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.dropped_d2c_telemetry_egress_message, var.message) + type = "query alert" query = < ${var.dropped_d2c_telemetry_egress_rate_threshold_critical} EOQ -thresholds = { -warning = var.dropped_d2c_telemetry_egress_rate_threshold_warning -critical = var.dropped_d2c_telemetry_egress_rate_threshold_critical -} + thresholds = { + warning = var.dropped_d2c_telemetry_egress_rate_threshold_warning + critical = var.dropped_d2c_telemetry_egress_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.dropped_d2c_telemetry_egress_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.dropped_d2c_telemetry_egress_extra_tags) } resource "datadog_monitor" "too_many_d2c_telemetry_egress_orphaned" { -count = var.orphaned_d2c_telemetry_egress_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress orphaned {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.orphaned_d2c_telemetry_egress_message, var.message) -type = "query alert" + count = var.orphaned_d2c_telemetry_egress_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] IOT Hub Too many d2c telemetry egress orphaned {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.orphaned_d2c_telemetry_egress_message, var.message) + type = "query alert" query = < 0 EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.too_many_d2c_telemetry_ingress_nosent_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:iothubs", "team:claranet", "created-by:terraform"], var.too_many_d2c_telemetry_ingress_nosent_extra_tags) } diff --git a/cloud/azure/keyvault/monitors-keyvault.tf b/cloud/azure/keyvault/monitors-keyvault.tf index c9e214e..d814756 100644 --- a/cloud/azure/keyvault/monitors-keyvault.tf +++ b/cloud/azure/keyvault/monitors-keyvault.tf @@ -10,24 +10,24 @@ resource "datadog_monitor" "keyvault_status" { ) < 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "keyvault_api_result" { - count = var.api_result_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Key Vault API result rate is low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.api_result_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Key Vault API result rate is low {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.status_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.api_latency_threshold_critical} EOQ -thresholds = { -critical = var.api_latency_threshold_critical -warning = var.api_latency_threshold_warning -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform"], var.api_latency_extra_tags) + thresholds = { + critical = var.api_latency_threshold_critical + warning = var.api_latency_threshold_warning + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:keyvault", "team:claranet", "created-by:terraform"], var.api_latency_extra_tags) } diff --git a/cloud/azure/load-balancer/monitors-load-balancer.tf b/cloud/azure/load-balancer/monitors-load-balancer.tf index 6b760e9..a782a31 100644 --- a/cloud/azure/load-balancer/monitors-load-balancer.tf +++ b/cloud/azure/load-balancer/monitors-load-balancer.tf @@ -10,14 +10,14 @@ resource "datadog_monitor" "loadbalancer_status" { ) < 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:load-balancer", "team:claranet", "created-by:terraform"], var.status_extra_tags) diff --git a/cloud/azure/mysql/monitors-mysql.tf b/cloud/azure/mysql/monitors-mysql.tf index 03fa5d0..c8a3399 100644 --- a/cloud/azure/mysql/monitors-mysql.tf +++ b/cloud/azure/mysql/monitors-mysql.tf @@ -12,27 +12,27 @@ EOQ thresholds = { critical = var.cpu_usage_threshold_critical - warning = var.cpu_usage_threshold_warning + warning = var.cpu_usage_threshold_warning } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.cpu_usage_extra_tags) } resource "datadog_monitor" "mysql_free_storage" { - count = var.free_storage_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server storage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.free_storage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server storage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.free_storage_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.io_consumption_threshold_critical} EOQ -thresholds = { -critical = var.io_consumption_threshold_critical -warning = var.io_consumption_threshold_warning -} + thresholds = { + critical = var.io_consumption_threshold_critical + warning = var.io_consumption_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.io_consumption_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:mysql", "team:claranet", "created-by:terraform"], var.io_consumption_extra_tags) } resource "datadog_monitor" "mysql_memory_usage" { -count = var.memory_usage_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.memory_usage_message, var.message) -type = "query alert" + count = var.memory_usage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Server memory usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.memory_usage_message, var.message) + type = "query alert" query = < ${var.evictedkeys_limit_threshold_critical} EOQ -thresholds = { -warning = var.evictedkeys_limit_threshold_warning -critical = var.evictedkeys_limit_threshold_critical -} + thresholds = { + warning = var.evictedkeys_limit_threshold_warning + critical = var.evictedkeys_limit_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_limit_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_limit_extra_tags) } resource "datadog_monitor" "percent_processor_time" { -count = var.percent_processor_time_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis processor time too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.percent_processor_time_message, var.message) -type = "query alert" + count = var.percent_processor_time_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis processor time too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.percent_processor_time_message, var.message) + type = "query alert" query = < ${var.percent_processor_time_threshold_critical} EOQ -thresholds = { -warning = var.percent_processor_time_threshold_warning -critical = var.percent_processor_time_threshold_critical -} + thresholds = { + warning = var.percent_processor_time_threshold_warning + critical = var.percent_processor_time_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.percent_processor_time_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:redis", "team:claranet", "created-by:terraform"], var.percent_processor_time_extra_tags) } resource "datadog_monitor" "server_load" { -count = var.server_load_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis server load too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.server_load_rate_message, var.message) -type = "query alert" + count = var.server_load_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis server load too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.server_load_rate_message, var.message) + type = "query alert" query = < ${var.cpu_percentage_threshold_critical} EOQ -thresholds = { -warning = var.cpu_percentage_threshold_warning -critical = var.cpu_percentage_threshold_critical -} + thresholds = { + warning = var.cpu_percentage_threshold_warning + critical = var.cpu_percentage_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.cpu_percentage_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.cpu_percentage_extra_tags) } resource "datadog_monitor" "memory_percentage" { -count = var.memory_percentage_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Serverfarm memory percentage is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.memory_percentage_message, var.message) - type = "query alert" + count = var.memory_percentage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Serverfarm memory percentage is too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.memory_percentage_message, var.message) + type = "query alert" query = < ${var.memory_percentage_threshold_critical} EOQ -thresholds = { -warning = var.memory_percentage_threshold_warning -critical = var.memory_percentage_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.memory_percentage_extra_tags) + thresholds = { + warning = var.memory_percentage_threshold_warning + critical = var.memory_percentage_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:serverfarms", "team:claranet", "created-by:terraform"], var.memory_percentage_extra_tags) } diff --git a/cloud/azure/servicebus/monitors-service-bus.tf b/cloud/azure/servicebus/monitors-service-bus.tf index 3da9b9f..31e810c 100644 --- a/cloud/azure/servicebus/monitors-service-bus.tf +++ b/cloud/azure/servicebus/monitors-service-bus.tf @@ -10,24 +10,24 @@ resource "datadog_monitor" "servicebus_status" { ) != 1 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.status_extra_tags) } resource "datadog_monitor" "service_bus_no_active_connections" { - count = var.no_active_connections_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus has no active connection" + count = var.no_active_connections_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus has no active connection" message = coalesce(var.no_active_connections_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.user_errors_threshold_critical} EOQ -thresholds = { -critical = var.user_errors_threshold_critical -warning = var.user_errors_threshold_warning -} + thresholds = { + critical = var.user_errors_threshold_critical + warning = var.user_errors_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.user_errors_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:servicebus", "team:claranet", "created-by:terraform"], var.user_errors_extra_tags) } resource "datadog_monitor" "service_bus_server_errors" { -count = var.server_errors_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus server errors rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.server_errors_message, var.message) -type = "query alert" + count = var.server_errors_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Service Bus server errors rate is high {{#is_alert}}{{comparator}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{comparator}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.server_errors_message, var.message) + type = "query alert" query = < ${var.cpu_threshold_critical} EOQ -thresholds = { -critical = var.cpu_threshold_critical -warning = var.cpu_threshold_warning -} + thresholds = { + critical = var.cpu_threshold_critical + warning = var.cpu_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } resource "datadog_monitor" "sql-database_free_space_low" { -count = var.diskspace_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database high disk usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.diskspace_message, var.message) -type = "query alert" + count = var.diskspace_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database high disk usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.diskspace_message, var.message) + type = "query alert" query = < ${var.diskspace_threshold_critical} EOQ -thresholds = { -warning = var.diskspace_threshold_warning -critical = var.diskspace_threshold_critical -} + thresholds = { + warning = var.diskspace_threshold_warning + critical = var.diskspace_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-database", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) } resource "datadog_monitor" "sql-database_dtu_consumption_high" { -count = var.dtu_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.dtu_message, var.message) -type = "query alert" + count = var.dtu_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Database DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.dtu_message, var.message) + type = "query alert" query = < ${var.diskspace_threshold_critical} EOQ -thresholds = { -warning = var.diskspace_threshold_warning -critical = var.diskspace_threshold_critical -} + thresholds = { + warning = var.diskspace_threshold_warning + critical = var.diskspace_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.diskspace_extra_tags) } resource "datadog_monitor" "sql_elasticpool_dtu_consumption_high" { -count = var.dtu_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Elastic Pool DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.dtu_message, var.message) -type = "query alert" + count = var.dtu_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] SQL Elastic Pool DTU Consumption too high {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.dtu_message, var.message) + type = "query alert" query = < ${var.dtu_threshold_critical} EOQ -thresholds = { -warning = var.dtu_threshold_warning -critical = var.dtu_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false - -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.dtu_extra_tags) + thresholds = { + warning = var.dtu_threshold_warning + critical = var.dtu_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:sql-elasticpool", "team:claranet", "created-by:terraform"], var.dtu_extra_tags) } diff --git a/cloud/azure/storage/monitors-azure-storage.tf b/cloud/azure/storage/monitors-azure-storage.tf index 9c25114..8b9f3f6 100644 --- a/cloud/azure/storage/monitors-azure-storage.tf +++ b/cloud/azure/storage/monitors-azure-storage.tf @@ -12,27 +12,27 @@ EOQ thresholds = { critical = var.availability_threshold_critical - warning = var.availability_threshold_warning + warning = var.availability_threshold_warning } - new_host_delay = var.new_host_delay - evaluation_delay = var.evaluation_delay - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = false - renotify_interval = 0 + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.availability_extra_tags) } resource "datadog_monitor" "successful_requests" { - count = var.successful_requests_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too few successful requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.successful_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too few successful requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.successful_requests_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.latency_threshold_critical} EOQ -thresholds = { -critical = var.latency_threshold_critical -warning = var.latency_threshold_warning -} + thresholds = { + critical = var.latency_threshold_critical + warning = var.latency_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.latency_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.latency_extra_tags) } resource "datadog_monitor" "timeout_error_requests" { -count = var.timeout_error_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many timeout errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.timeout_error_requests_message, var.message) -type = "query alert" + count = var.timeout_error_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many timeout errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.timeout_error_requests_message, var.message) + type = "query alert" query = < ${var.throttling_error_requests_threshold_critical} EOQ -thresholds = { -critical = var.throttling_error_requests_threshold_critical -warning = var.throttling_error_requests_threshold_warning -} + thresholds = { + critical = var.throttling_error_requests_threshold_critical + warning = var.throttling_error_requests_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.throttling_error_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.throttling_error_requests_extra_tags) } resource "datadog_monitor" "server_other_error_requests" { -count = var.server_other_error_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many server_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.server_other_error_requests_message, var.message) -type = "query alert" + count = var.server_other_error_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many server_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.server_other_error_requests_message, var.message) + type = "query alert" query = < ${var.server_other_error_requests_threshold_critical} EOQ -thresholds = { -critical = var.server_other_error_requests_threshold_critical -warning = var.server_other_error_requests_threshold_warning -} + thresholds = { + critical = var.server_other_error_requests_threshold_critical + warning = var.server_other_error_requests_threshold_warning + } -new_host_delay = var.new_host_delay -evaluation_delay = var.evaluation_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false -renotify_interval = 0 + new_host_delay = var.new_host_delay + evaluation_delay = var.evaluation_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.server_other_error_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:storage", "team:claranet", "created-by:terraform"], var.server_other_error_requests_extra_tags) } resource "datadog_monitor" "client_other_error_requests" { -count = var.client_other_error_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many client_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.client_other_error_requests_message, var.message) -type = "query alert" + count = var.client_other_error_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Azure Storage too many client_other errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.client_other_error_requests_message, var.message) + type = "query alert" query = < ${var.su_utilization_threshold_critical} EOQ -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -thresholds = { -warning = var.su_utilization_threshold_warning -critical = var.su_utilization_threshold_critical -} + thresholds = { + warning = var.su_utilization_threshold_warning + critical = var.su_utilization_threshold_critical + } -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.su_utilization_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.su_utilization_extra_tags) } resource "datadog_monitor" "failed_function_requests" { -count = var.failed_function_requests_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.failed_function_requests_message, var.message) -type = "query alert" + count = var.failed_function_requests_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many failed requests {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.failed_function_requests_message, var.message) + type = "query alert" query = < ${var.failed_function_requests_threshold_critical} EOQ -thresholds = { -warning = var.failed_function_requests_threshold_warning -critical = var.failed_function_requests_threshold_critical -} + thresholds = { + warning = var.failed_function_requests_threshold_warning + critical = var.failed_function_requests_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 60 -notify_audit = false -timeout_h = 1 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 60 + notify_audit = false + timeout_h = 1 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.failed_function_requests_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:stream-analytics", "team:claranet", "created-by:terraform"], var.failed_function_requests_extra_tags) } resource "datadog_monitor" "conversion_errors" { -count = var.conversion_errors_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many conversion errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.conversion_errors_message, var.message) -type = "query alert" + count = var.conversion_errors_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Stream Analytics too many conversion errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.conversion_errors_message, var.message) + type = "query alert" query = < ${var.cpu_usage_threshold_critical} EOQ -thresholds = { -critical = var.cpu_usage_threshold_critical -warning = var.cpu_usage_threshold_warning -} + thresholds = { + critical = var.cpu_usage_threshold_critical + warning = var.cpu_usage_threshold_warning + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform"], var.cpu_usage_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:azure", "resource:virtualmachine", "team:claranet", "created-by:terraform"], var.cpu_usage_extra_tags) } resource "datadog_monitor" "virtualmachine_credit_cpu_remaining_too_low" { -count = var.cpu_remaining_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Virtual Machine credit CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.cpu_remaining_rate_message, var.message) -type = "query alert" + count = var.cpu_remaining_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Virtual Machine credit CPU {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.cpu_remaining_rate_message, var.message) + type = "query alert" query = < ${var.execution_time_threshold_critical} EOQ -thresholds = { -warning = var.execution_time_threshold_warning -critical = var.execution_time_threshold_critical -} + thresholds = { + warning = var.execution_time_threshold_warning + critical = var.execution_time_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -include_tags = true -notify_no_data = false -require_full_window = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + include_tags = true + notify_no_data = false + require_full_window = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.execution_time_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.execution_time_extra_tags) } # # Scanned Bytes # resource "datadog_monitor" "scanned_bytes" { -count = var.scanned_bytes_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" -message = coalesce(var.scanned_bytes_message, var.message) -type = "query alert" + count = var.scanned_bytes_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" + message = coalesce(var.scanned_bytes_message, var.message) + type = "query alert" query = < ${var.scanned_bytes_threshold_critical} EOQ -thresholds = { -warning = var.scanned_bytes_threshold_warning -critical = var.scanned_bytes_threshold_critical -} + thresholds = { + warning = var.scanned_bytes_threshold_warning + critical = var.scanned_bytes_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -include_tags = true -notify_no_data = false -require_full_window = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + include_tags = true + notify_no_data = false + require_full_window = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.scanned_bytes_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.scanned_bytes_extra_tags) } # # Scanned Bytes Billed # resource "datadog_monitor" "scanned_bytes_billed" { -count = var.scanned_bytes_billed_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes Billed {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" -message = coalesce(var.scanned_bytes_billed_message, var.message) -type = "query alert" + count = var.scanned_bytes_billed_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Scanned Bytes Billed {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" + message = coalesce(var.scanned_bytes_billed_message, var.message) + type = "query alert" query = < ${var.stored_bytes_threshold_critical} EOQ -thresholds = { -warning = var.stored_bytes_threshold_warning -critical = var.stored_bytes_threshold_critical -} + thresholds = { + warning = var.stored_bytes_threshold_warning + critical = var.stored_bytes_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -include_tags = true -notify_no_data = false -require_full_window = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + include_tags = true + notify_no_data = false + require_full_window = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.stored_bytes_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.stored_bytes_extra_tags) } # # Table Count # resource "datadog_monitor" "table_count" { -count = var.table_count_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Table Count {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.table_count_message, var.message) -type = "metric alert" + count = var.table_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Table Count {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.table_count_message, var.message) + type = "metric alert" query = < ${var.table_count_threshold_critical} EOQ -thresholds = { -warning = var.table_count_threshold_warning -critical = var.table_count_threshold_critical -} + thresholds = { + warning = var.table_count_threshold_warning + critical = var.table_count_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -include_tags = true -notify_no_data = false -require_full_window = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + include_tags = true + notify_no_data = false + require_full_window = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + locked = false -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.table_count_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:big-query", "team:claranet", "created-by:terraform"], var.table_count_extra_tags) } # # Uploaded Bytes # resource "datadog_monitor" "uploaded_bytes" { -count = var.uploaded_bytes_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Uploaded Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" -message = coalesce(var.uploaded_bytes_message, var.message) -type = "query alert" + count = var.uploaded_bytes_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP Big Query Uploaded Bytes {{#is_alert}}{{{comparator}}} {{threshold}}B/mn ({{value}}B/mn){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}B/mn ({{value}}B/mn){{/is_warning}}" + message = coalesce(var.uploaded_bytes_message, var.message) + type = "query alert" query = < ${var.disk_utilization_threshold_critical} EOQ -thresholds = { -warning = var.disk_utilization_threshold_warning -critical = var.disk_utilization_threshold_critical -} + thresholds = { + warning = var.disk_utilization_threshold_warning + critical = var.disk_utilization_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = true -renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = true + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.disk_utilization_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.disk_utilization_extra_tags) } # # Disk Utilization Forecast # resource "datadog_monitor" "disk_utilization_forecast" { -count = var.disk_utilization_forecast_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Disk Utilization could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" -message = coalesce(var.disk_utilization_forecast_message, var.message) - type = "query alert" + count = var.disk_utilization_forecast_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Disk Utilization could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" + message = coalesce(var.disk_utilization_forecast_message, var.message) + type = "query alert" query = <= ${var.memory_utilization_forecast_threshold_critical} EOQ - thresholds = { - critical = var.memory_utilization_forecast_threshold_critical - critical_recovery = var.memory_utilization_forecast_threshold_critical_recovery - } + thresholds = { + critical = var.memory_utilization_forecast_threshold_critical + critical_recovery = var.memory_utilization_forecast_threshold_critical_recovery + } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true - require_full_window = false - notify_no_data = false - renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = false + renotify_interval = 0 - tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.memory_utilization_forecast_extra_tags) - } + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:cloud-sql", "team:claranet", "created-by:terraform"], var.memory_utilization_forecast_extra_tags) +} - # - # Failover Unavailable - # - resource "datadog_monitor" "failover_unavailable" { - count = var.failover_unavailable_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Failover Unavailable" - message = coalesce(var.failover_unavailable_message, var.message) - type = "metric alert" +# +# Failover Unavailable +# +resource "datadog_monitor" "failover_unavailable" { + count = var.failover_unavailable_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Cloud SQL Failover Unavailable" + message = coalesce(var.failover_unavailable_message, var.message) + type = "metric alert" query = < ${var.disk_throttled_bps_threshold_critical} EOQ -thresholds = { -warning = var.disk_throttled_bps_threshold_warning -critical = var.disk_throttled_bps_threshold_critical -} + thresholds = { + warning = var.disk_throttled_bps_threshold_warning + critical = var.disk_throttled_bps_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = var.disk_throttled_bps_notify_no_data -renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = var.disk_throttled_bps_notify_no_data + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_bps_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_bps_extra_tags) } # # Disk Throttled OPS # resource "datadog_monitor" "disk_throttled_ops" { -count = var.disk_throttled_ops_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Compute Engine instance Disk Throttled OPS {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.disk_throttled_ops_message, var.message) -type = "query alert" + count = var.disk_throttled_ops_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Compute Engine instance Disk Throttled OPS {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.disk_throttled_ops_message, var.message) + type = "query alert" query = < ${var.disk_throttled_ops_threshold_critical} EOQ -thresholds = { -warning = var.disk_throttled_ops_threshold_warning -critical = var.disk_throttled_ops_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = var.disk_throttled_ops_notify_no_data -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -renotify_interval = 0 - -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_ops_extra_tags) + thresholds = { + warning = var.disk_throttled_ops_threshold_warning + critical = var.disk_throttled_ops_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = var.disk_throttled_ops_notify_no_data + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + renotify_interval = 0 + + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:gce-instance", "team:claranet", "created-by:terraform"], var.disk_throttled_ops_extra_tags) } diff --git a/cloud/gcp/lb/monitors-lb.tf b/cloud/gcp/lb/monitors-lb.tf index 810800e..e193b78 100644 --- a/cloud/gcp/lb/monitors-lb.tf +++ b/cloud/gcp/lb/monitors-lb.tf @@ -15,19 +15,19 @@ resource "datadog_monitor" "error_rate_4xx" { EOQ thresholds = { - warning = var.error_rate_4xx_threshold_warning + warning = var.error_rate_4xx_threshold_warning critical = var.error_rate_4xx_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = false - notify_no_data = false - renotify_interval = 0 + notify_no_data = false + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_4xx_extra_tags) } @@ -36,10 +36,10 @@ EOQ # 5XX Errors # resource "datadog_monitor" "error_rate_5xx" { - count = var.error_rate_5xx_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.error_rate_5xx_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB 5xx errors {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.error_rate_5xx_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.error_rate_5xx_threshold_critical} EOQ -thresholds = { -warning = var.error_rate_5xx_threshold_warning -critical = var.error_rate_5xx_threshold_critical -} + thresholds = { + warning = var.error_rate_5xx_threshold_warning + critical = var.error_rate_5xx_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = false -renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_5xx_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.error_rate_5xx_extra_tags) } # # Backend Latency for service # resource "datadog_monitor" "backend_latency_service" { -count = var.backend_latency_service_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB service backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.backend_latency_service_message, var.message) -type = "query alert" + count = var.backend_latency_service_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB service backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.backend_latency_service_message, var.message) + type = "query alert" query = < ${var.backend_latency_service_threshold_critical} EOQ -thresholds = { -warning = var.backend_latency_service_threshold_warning -critical = var.backend_latency_service_threshold_critical -} + thresholds = { + warning = var.backend_latency_service_threshold_warning + critical = var.backend_latency_service_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = false -renotify_interval = 0 + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = false + renotify_interval = 0 -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.backend_latency_service_extra_tags) + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:lb", "team:claranet", "created-by:terraform"], var.backend_latency_service_extra_tags) } # # Backend Latency for bucket # resource "datadog_monitor" "backend_latency_bucket" { -count = var.backend_latency_bucket_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB bucket backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.backend_latency_bucket_message, var.message) -type = "query alert" + count = var.backend_latency_bucket_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] GCP LB bucket backend latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.backend_latency_bucket_message, var.message) + type = "query alert" query = <= ${var.unavailable_sending_operations_count_threshold_critical} EOQ -thresholds = { -warning = var.unavailable_sending_operations_count_threshold_warning -critical = var.unavailable_sending_operations_count_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -timeout_h = 0 -include_tags = true -require_full_window = false -notify_no_data = false -renotify_interval = 0 - -tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform"], var.unavailable_sending_operations_count_extra_tags) + thresholds = { + warning = var.unavailable_sending_operations_count_threshold_warning + critical = var.unavailable_sending_operations_count_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true + require_full_window = false + notify_no_data = false + renotify_interval = 0 + + tags = concat(["env:${var.environment}", "type:cloud", "provider:gcp", "resource:pubsub", "team:claranet", "created-by:terraform"], var.unavailable_sending_operations_count_extra_tags) } diff --git a/common/alerting-message/main.tf b/common/alerting-message/main.tf index 1f81058..3c45dd7 100644 --- a/common/alerting-message/main.tf +++ b/common/alerting-message/main.tf @@ -12,11 +12,11 @@ EOF vars = { - message_alert = var.message_alert + message_alert = var.message_alert message_warning = var.message_warning - message_nodata = coalesce(var.message_nodata, var.message_alert) - prepend_text = var.prepend_text - append_text = var.append_text + message_nodata = coalesce(var.message_nodata, var.message_alert) + prepend_text = var.prepend_text + append_text = var.append_text } } diff --git a/database/elasticsearch/monitors-elasticsearch.tf b/database/elasticsearch/monitors-elasticsearch.tf index c380c4e..d5bd81c 100644 --- a/database/elasticsearch/monitors-elasticsearch.tf +++ b/database/elasticsearch/monitors-elasticsearch.tf @@ -12,19 +12,19 @@ resource "datadog_monitor" "not_responding" { EOQ thresholds = { - warning = var.not_responding_threshold_warning + warning = var.not_responding_threshold_warning critical = 5 } - no_data_timeframe = var.not_responding_no_data_timeframe - new_host_delay = var.new_host_delay - notify_no_data = true - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + no_data_timeframe = var.not_responding_no_data_timeframe + new_host_delay = var.new_host_delay + notify_no_data = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = true - renotify_interval = 0 + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.not_responding_extra_tags) } @@ -33,10 +33,10 @@ EOQ # Cluster Status Not Green # resource "datadog_monitor" "cluster_status_not_green" { - count = var.cluster_status_not_green_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster status not green" + count = var.cluster_status_not_green_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster status not green" message = coalesce(var.cluster_status_not_green_message, var.message) - type = "metric alert" + type = "metric alert" query = < ${var.cluster_initializing_shards_threshold_critical} EOQ -thresholds = { -warning = var.cluster_initializing_shards_threshold_warning -critical = var.cluster_initializing_shards_threshold_critical -} + thresholds = { + warning = var.cluster_initializing_shards_threshold_warning + critical = var.cluster_initializing_shards_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cluster_initializing_shards_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.cluster_initializing_shards_extra_tags) } # # Cluster Relocating Shards # resource "datadog_monitor" "cluster_relocating_shards" { -count = var.cluster_relocating_shards_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster is relocating shards" -message = coalesce(var.cluster_relocating_shards_message, var.message) -type = "metric alert" + count = var.cluster_relocating_shards_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] ElasticSearch Cluster is relocating shards" + message = coalesce(var.cluster_relocating_shards_message, var.message) + type = "metric alert" query = < ${var.jvm_heap_memory_usage_threshold_critical} EOQ -thresholds = { -warning = var.jvm_heap_memory_usage_threshold_warning -critical = var.jvm_heap_memory_usage_threshold_critical -} + thresholds = { + warning = var.jvm_heap_memory_usage_threshold_warning + critical = var.jvm_heap_memory_usage_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_heap_memory_usage_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_heap_memory_usage_extra_tags) } # # JVM Memory Young Usage # resource "datadog_monitor" "jvm_memory_young_usage" { -count = var.jvm_memory_young_usage_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch JVM memory Young usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.jvm_memory_young_usage_message, var.message) -type = "query alert" + count = var.jvm_memory_young_usage_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch JVM memory Young usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.jvm_memory_young_usage_message, var.message) + type = "query alert" query = < ${var.jvm_gc_old_collection_latency_threshold_critical} EOQ -thresholds = { -warning = var.jvm_gc_old_collection_latency_threshold_warning -critical = var.jvm_gc_old_collection_latency_threshold_critical -} + thresholds = { + warning = var.jvm_gc_old_collection_latency_threshold_warning + critical = var.jvm_gc_old_collection_latency_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_gc_old_collection_latency_extra_tags) } @@ -317,10 +317,10 @@ notify_no_data = false # JVM Garbace Collector Young Collection Latency # resource "datadog_monitor" "jvm_gc_young_collection_latency" { -count = var.jvm_gc_young_collection_latency_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average Young-generation garbage collections latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.jvm_gc_young_collection_latency_message, var.message) -type = "query alert" + count = var.jvm_gc_young_collection_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average Young-generation garbage collections latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.jvm_gc_young_collection_latency_message, var.message) + type = "query alert" query = < ${var.jvm_gc_young_collection_latency_threshold_critical} EOQ -thresholds = { -warning = var.jvm_gc_young_collection_latency_threshold_warning -critical = var.jvm_gc_young_collection_latency_threshold_critical -} + thresholds = { + warning = var.jvm_gc_young_collection_latency_threshold_warning + critical = var.jvm_gc_young_collection_latency_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_gc_young_collection_latency_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.jvm_gc_young_collection_latency_extra_tags) } # # Indexing Latency # resource "datadog_monitor" "indexing_latency" { -count = var.indexing_latency_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average indexing time by document {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.indexing_latency_message, var.message) -type = "query alert" + count = var.indexing_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average indexing time by document {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.indexing_latency_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = <= ${var.http_connections_anomaly_threshold_critical} EOQ -thresholds = { -warning = var.http_connections_anomaly_threshold_warning -critical = var.http_connections_anomaly_threshold_critical -} + thresholds = { + warning = var.http_connections_anomaly_threshold_warning + critical = var.http_connections_anomaly_threshold_critical + } -threshold_windows = { -trigger_window = var.http_connections_anomaly_alert_window -recovery_window = var.http_connections_anomaly_alert_window -} + threshold_windows = { + trigger_window = var.http_connections_anomaly_alert_window + recovery_window = var.http_connections_anomaly_alert_window + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.http_connections_anomaly_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.http_connections_anomaly_extra_tags) } # # Query Latency # resource "datadog_monitor" "search_query_latency" { -count = var.search_query_latency_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search query latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.search_query_latency_message, var.message) -type = "query alert" + count = var.search_query_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search query latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.search_query_latency_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.search_query_latency_threshold_critical} EOQ -thresholds = { -warning = var.search_query_latency_threshold_warning -critical = var.search_query_latency_threshold_critical -} + thresholds = { + warning = var.search_query_latency_threshold_warning + critical = var.search_query_latency_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.search_query_latency_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.search_query_latency_extra_tags) } # # Fetch Latency # resource "datadog_monitor" "fetch_latency" { -count = var.fetch_latency_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search fetch latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" -message = coalesce(var.fetch_latency_message, var.message) -type = "query alert" + count = var.fetch_latency_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch average search fetch latency {{#is_alert}}{{{comparator}}} {{threshold}}ms ({{value}}ms){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}ms ({{value}}ms){{/is_warning}}" + message = coalesce(var.fetch_latency_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = <= ${var.fetch_change_threshold_critical} EOQ -thresholds = { -warning = var.fetch_change_threshold_warning -critical = var.fetch_change_threshold_critical -} + thresholds = { + warning = var.fetch_change_threshold_warning + critical = var.fetch_change_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.fetch_change_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.fetch_change_extra_tags) } # # Field Data Evictions # resource "datadog_monitor" "field_data_evictions_change" { -count = var.field_data_evictions_change_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the total number of evictions from the fielddata cache" -message = coalesce(var.field_data_evictions_change_message, var.message) -type = "query alert" + count = var.field_data_evictions_change_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the total number of evictions from the fielddata cache" + message = coalesce(var.field_data_evictions_change_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.field_data_evictions_change_threshold_critical} EOQ -thresholds = { -warning = var.field_data_evictions_change_threshold_warning -critical = var.field_data_evictions_change_threshold_critical -} + thresholds = { + warning = var.field_data_evictions_change_threshold_warning + critical = var.field_data_evictions_change_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.field_data_evictions_change_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.field_data_evictions_change_extra_tags) } # # Query Cache Evictions # resource "datadog_monitor" "query_cache_evictions_change" { -count = var.query_cache_evictions_change_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of query cache evictions" -message = coalesce(var.query_cache_evictions_change_message, var.message) -type = "query alert" + count = var.query_cache_evictions_change_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Elasticsearch change alert on the number of query cache evictions" + message = coalesce(var.query_cache_evictions_change_message, var.message) + type = "query alert" -// TODO add tags to filter by node type and do not apply this monitor on non-data nodes + // TODO add tags to filter by node type and do not apply this monitor on non-data nodes query = < ${var.task_time_in_queue_change_threshold_critical} EOQ -thresholds = { -warning = var.task_time_in_queue_change_threshold_warning -critical = var.task_time_in_queue_change_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_audit = false -locked = false -include_tags = true -require_full_window = true -notify_no_data = false - -tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.task_time_in_queue_change_extra_tags) + thresholds = { + warning = var.task_time_in_queue_change_threshold_warning + critical = var.task_time_in_queue_change_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_audit = false + locked = false + include_tags = true + require_full_window = true + notify_no_data = false + + tags = concat(["env:${var.environment}", "type:database", "provider:elasticsearch", "resource:elasticsearch", "team:claranet", "created-by:terraform"], var.task_time_in_queue_change_extra_tags) } diff --git a/database/mongodb/monitors-mongo.tf b/database/mongodb/monitors-mongo.tf index cacc3ea..2c92c67 100644 --- a/database/mongodb/monitors-mongo.tf +++ b/database/mongodb/monitors-mongo.tf @@ -8,23 +8,23 @@ resource "datadog_monitor" "mongodb_primary" { ${var.mongodb_primary_aggregator}(${var.mongodb_primary_timeframe}): min:mongodb.replset.state${module.filter-tags.query_alert} by {replset_name} >= 2 EOQ - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true require_full_window = true tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_primary_extra_tags) } resource "datadog_monitor" "mongodb_secondary" { - count = var.mongodb_secondary_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB secondary missing" + count = var.mongodb_secondary_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB secondary missing" message = coalesce(var.mongodb_secondary_message, var.message) - type = "query alert" + type = "query alert" query = < 1 EOQ -thresholds = { -critical = 1 -warning = 0 -} + thresholds = { + critical = 1 + warning = 0 + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + require_full_window = true -tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) } resource "datadog_monitor" "mongodb_server_count" { -count = var.mongodb_server_count_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB too much servers or wrong monitoring config" -message = coalesce(var.mongodb_server_count_message, var.message) -type = "metric alert" + count = var.mongodb_server_count_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB too much servers or wrong monitoring config" + message = coalesce(var.mongodb_server_count_message, var.message) + type = "metric alert" query = < 99 EOQ -thresholds = { -critical = 99 -warning = var.mongodb_desired_servers_count -} + thresholds = { + critical = 99 + warning = var.mongodb_desired_servers_count + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + require_full_window = true -tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mongo", "resource:mongodb", "team:claranet", "created-by:terraform"], var.mongodb_secondary_extra_tags) } resource "datadog_monitor" "mongodb_replication" { -count = var.mongodb_replication_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB replication lag" -message = coalesce(var.mongodb_replication_message, var.message) -type = "metric alert" + count = var.mongodb_replication_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] MongoDB replication lag" + message = coalesce(var.mongodb_replication_message, var.message) + type = "metric alert" query = < ${var.mysql_connection_threshold_critical} EOQ -thresholds = { -warning = var.mysql_connection_threshold_warning -critical = var.mysql_connection_threshold_critical -} + thresholds = { + warning = var.mysql_connection_threshold_warning + critical = var.mysql_connection_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_connection_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_connection_extra_tags) } resource "datadog_monitor" "mysql_aborted" { -count = var.mysql_aborted_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Aborted connects {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.mysql_aborted_message, var.message) -type = "query alert" + count = var.mysql_aborted_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Aborted connects {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.mysql_aborted_message, var.message) + type = "query alert" query = < ${var.mysql_aborted_threshold_critical} EOQ -thresholds = { -warning = var.mysql_aborted_threshold_warning -critical = var.mysql_aborted_threshold_critical -} + thresholds = { + warning = var.mysql_aborted_threshold_warning + critical = var.mysql_aborted_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_aborted_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_aborted_extra_tags) } resource "datadog_monitor" "mysql_slow" { -count = var.mysql_slow_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Slow queries {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.mysql_slow_message, var.message) -type = "query alert" + count = var.mysql_slow_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql Slow queries {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.mysql_slow_message, var.message) + type = "query alert" query = < ${var.mysql_pool_utilization_threshold_critical} EOQ -thresholds = { -warning = var.mysql_pool_utilization_threshold_warning -critical = var.mysql_pool_utilization_threshold_critical -} + thresholds = { + warning = var.mysql_pool_utilization_threshold_warning + critical = var.mysql_pool_utilization_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_pool_utilization_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_pool_utilization_extra_tags) } resource "datadog_monitor" "mysql_threads_anomaly" { -count = var.mysql_threads_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql threads changed abnormally" -message = coalesce(var.mysql_threads_message, var.message) -type = "metric alert" + count = var.mysql_threads_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql threads changed abnormally" + message = coalesce(var.mysql_threads_message, var.message) + type = "metric alert" query = <= ${var.mysql_threads_threshold_critical} EOQ -thresholds = { -critical = var.mysql_threads_threshold_critical -critical_recovery = 0 -} + thresholds = { + critical = var.mysql_threads_threshold_critical + critical_recovery = 0 + } -threshold_windows = { -trigger_window = var.mysql_threads_alert_window -recovery_window = var.mysql_threads_alert_window -} + threshold_windows = { + trigger_window = var.mysql_threads_alert_window + recovery_window = var.mysql_threads_alert_window + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_threads_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:mysql", "resource:mysql", "team:claranet", "created-by:terraform"], var.mysql_threads_extra_tags) } resource "datadog_monitor" "mysql_questions_anomaly" { -count = var.mysql_questions_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql queries changed abnormally" -message = coalesce(var.mysql_questions_message, var.message) -type = "metric alert" + count = var.mysql_questions_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Mysql queries changed abnormally" + message = coalesce(var.mysql_questions_message, var.message) + type = "metric alert" query = < ${var.postgresql_connection_threshold_critical} EOQ -thresholds = { -warning = var.postgresql_connection_threshold_warning -critical = var.postgresql_connection_threshold_critical -} + thresholds = { + warning = var.postgresql_connection_threshold_warning + critical = var.postgresql_connection_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true -tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_connection_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_connection_extra_tags) } resource "datadog_monitor" "postgresql_too_many_locks" { -count = var.postgresql_lock_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] PostgreSQL too many locks {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.postgresql_lock_message, var.message) -type = "query alert" + count = var.postgresql_lock_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] PostgreSQL too many locks {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.postgresql_lock_message, var.message) + type = "query alert" query = < ${var.postgresql_lock_threshold_critical} EOQ -thresholds = { -warning = var.postgresql_lock_threshold_warning -critical = var.postgresql_lock_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -require_full_window = true -timeout_h = 0 -include_tags = true - -tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_lock_extra_tags) + thresholds = { + warning = var.postgresql_lock_threshold_warning + critical = var.postgresql_lock_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + require_full_window = true + timeout_h = 0 + include_tags = true + + tags = concat(["env:${var.environment}", "type:database", "provider:postgres", "resource:postgresql", "team:claranet", "created-by:terraform"], var.postgresql_lock_extra_tags) } diff --git a/database/redis/monitors-redis.tf b/database/redis/monitors-redis.tf index baa501c..6352db8 100644 --- a/database/redis/monitors-redis.tf +++ b/database/redis/monitors-redis.tf @@ -12,28 +12,28 @@ resource "datadog_monitor" "not_responding" { EOQ thresholds = { - warning = var.not_responding_threshold_warning + warning = var.not_responding_threshold_warning critical = 5 } - new_host_delay = var.new_host_delay - no_data_timeframe = var.not_responding_no_data_timeframe - notify_no_data = true - notify_audit = false - locked = false - timeout_h = 0 - include_tags = true + new_host_delay = var.new_host_delay + no_data_timeframe = var.not_responding_no_data_timeframe + notify_no_data = true + notify_audit = false + locked = false + timeout_h = 0 + include_tags = true require_full_window = true - renotify_interval = 0 + renotify_interval = 0 tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.not_responding_extra_tags) } resource "datadog_monitor" "evicted_keys" { - count = var.evictedkeys_change_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis evicted keys {{#is_alert}}{{{comparator}}} {{threshold}}% (+{{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% (+{{value}}%){{/is_warning}}" + count = var.evictedkeys_change_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis evicted keys {{#is_alert}}{{{comparator}}} {{threshold}}% (+{{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% (+{{value}}%){{/is_warning}}" message = coalesce(var.evictedkeys_change_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.evictedkeys_change_threshold_critical} EOQ -thresholds = { -warning = var.evictedkeys_change_threshold_warning -critical = var.evictedkeys_change_threshold_critical -} + thresholds = { + warning = var.evictedkeys_change_threshold_warning + critical = var.evictedkeys_change_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true -tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_change_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.evictedkeys_change_extra_tags) } resource "datadog_monitor" "expirations" { -count = var.expirations_rate_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis expired keys {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.expirations_rate_message, var.message) -type = "query alert" + count = var.expirations_rate_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis expired keys {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.expirations_rate_message, var.message) + type = "query alert" query = < ${var.expirations_rate_threshold_critical} EOQ -thresholds = { -warning = var.expirations_rate_threshold_warning -critical = var.expirations_rate_threshold_critical -} + thresholds = { + warning = var.expirations_rate_threshold_warning + critical = var.expirations_rate_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.expirations_rate_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.expirations_rate_extra_tags) } resource "datadog_monitor" "blocked_clients" { -count = var.blocked_clients_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis blocked clients {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.blocked_clients_message, var.message) -type = "query alert" + count = var.blocked_clients_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis blocked clients {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.blocked_clients_message, var.message) + type = "query alert" query = < ${var.mem_used_threshold_critical} EOQ -thresholds = { -warning = var.mem_used_threshold_warning -critical = var.mem_used_threshold_critical -} + thresholds = { + warning = var.mem_used_threshold_warning + critical = var.mem_used_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_used_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_used_extra_tags) } resource "datadog_monitor" "memory_frag" { -count = var.mem_frag_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis memory fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.mem_frag_message, var.message) -type = "query alert" + count = var.mem_frag_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis memory fragmented {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.mem_frag_message, var.message) + type = "query alert" query = < ${var.mem_frag_threshold_critical} EOQ -thresholds = { -warning = var.mem_frag_threshold_warning -critical = var.mem_frag_threshold_critical -} + thresholds = { + warning = var.mem_frag_threshold_warning + critical = var.mem_frag_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -renotify_interval = 0 -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = false -tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_frag_extra_tags) + tags = concat(["env:${var.environment}", "type:database", "provider:redisdb", "resource:redis", "team:claranet", "created-by:terraform"], var.mem_frag_extra_tags) } resource "datadog_monitor" "rejected_connections" { -count = var.rejected_con_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis rejected connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" -message = coalesce(var.rejected_con_message, var.message) -type = "query alert" + count = var.rejected_con_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Redis rejected connections {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + message = coalesce(var.rejected_con_message, var.message) + type = "query alert" query = < ${var.nginx_dropped_threshold_critical} EOQ -thresholds = { -critical = var.nginx_dropped_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform"], var.nginx_dropped_extra_tags) + thresholds = { + critical = var.nginx_dropped_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:middleware", "provider:nginx", "resource:nginx", "team:claranet", "created-by:terraform"], var.nginx_dropped_extra_tags) } diff --git a/middleware/php-fpm/monitors-fpm.tf b/middleware/php-fpm/monitors-fpm.tf index 44f5b20..11e6323 100644 --- a/middleware/php-fpm/monitors-fpm.tf +++ b/middleware/php-fpm/monitors-fpm.tf @@ -9,28 +9,28 @@ resource "datadog_monitor" "php_fpm_connect" { EOQ thresholds = { - warning = var.php_fpm_connect_threshold_warning + warning = var.php_fpm_connect_threshold_warning critical = 5 } - no_data_timeframe = var.php_fpm_connect_no_data_timeframe - new_host_delay = var.new_host_delay - notify_no_data = true - renotify_interval = 0 - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + no_data_timeframe = var.php_fpm_connect_no_data_timeframe + new_host_delay = var.new_host_delay + notify_no_data = true + renotify_interval = 0 + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform"], var.php_fpm_connect_extra_tags) } resource "datadog_monitor" "php_fpm_connect_idle" { - count = var.php_fpm_busy_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Php-fpm busy worker {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + count = var.php_fpm_busy_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Php-fpm busy worker {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" message = coalesce(var.php_fpm_busy_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.php_fpm_busy_threshold_critical} EOQ -thresholds = { -warning = var.php_fpm_busy_threshold_warning -critical = var.php_fpm_busy_threshold_critical -} - -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true - -tags = concat(["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform"], var.php_fpm_busy_extra_tags) + thresholds = { + warning = var.php_fpm_busy_threshold_warning + critical = var.php_fpm_busy_threshold_critical + } + + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true + + tags = concat(["env:${var.environment}", "type:middleware", "provider:php-fpm", "resource:php-fpm", "team:claranet", "created-by:terraform"], var.php_fpm_busy_extra_tags) } diff --git a/system/generic/monitors-system.tf b/system/generic/monitors-system.tf index 192c038..d61bc0e 100644 --- a/system/generic/monitors-system.tf +++ b/system/generic/monitors-system.tf @@ -11,27 +11,27 @@ resource "datadog_monitor" "cpu" { EOQ thresholds = { - warning = var.cpu_threshold_warning + warning = var.cpu_threshold_warning critical = var.cpu_threshold_critical } - evaluation_delay = var.evaluation_delay - new_host_delay = var.new_host_delay - notify_no_data = false - notify_audit = false - timeout_h = 0 - include_tags = true - locked = false + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false require_full_window = true tags = concat(["env:${var.environment}", "type:system", "provider:system-check", "resource:generic", "team:claranet", "created-by:terraform"], var.cpu_extra_tags) } resource "datadog_monitor" "load" { - count = var.load_enabled == "true" ? 1 : 0 - name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] CPU load 5 ratio {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" + count = var.load_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] CPU load 5 ratio {{#is_alert}}{{{comparator}}} {{threshold}} ({{value}}){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}} ({{value}}){{/is_warning}}" message = coalesce(var.load_message, var.message) - type = "query alert" + type = "query alert" query = < ${var.load_threshold_critical} EOQ -thresholds = { -warning = var.load_threshold_warning -critical = var.load_threshold_critical -} + thresholds = { + warning = var.load_threshold_warning + critical = var.load_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true -tags = concat(["env:${var.environment}", "type:system", "provider:system-core", "resource:generic", "team:claranet", "created-by:terraform"], var.load_extra_tags) + tags = concat(["env:${var.environment}", "type:system", "provider:system-core", "resource:generic", "team:claranet", "created-by:terraform"], var.load_extra_tags) } resource "datadog_monitor" "disk_space" { -count = var.disk_space_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk space usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" -message = coalesce(var.disk_space_message, var.message) -type = "query alert" + count = var.disk_space_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk space usage {{#is_alert}}{{{comparator}}} {{threshold}}% ({{value}}%){{/is_alert}}{{#is_warning}}{{{comparator}}} {{warn_threshold}}% ({{value}}%){{/is_warning}}" + message = coalesce(var.disk_space_message, var.message) + type = "query alert" query = < ${var.disk_space_threshold_critical} EOQ -thresholds = { -warning = var.disk_space_threshold_warning -critical = var.disk_space_threshold_critical -} + thresholds = { + warning = var.disk_space_threshold_warning + critical = var.disk_space_threshold_critical + } -evaluation_delay = var.evaluation_delay -new_host_delay = var.new_host_delay -notify_no_data = false -notify_audit = false -timeout_h = 0 -include_tags = true -locked = false -require_full_window = true + evaluation_delay = var.evaluation_delay + new_host_delay = var.new_host_delay + notify_no_data = false + notify_audit = false + timeout_h = 0 + include_tags = true + locked = false + require_full_window = true -tags = concat(["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform"], var.disk_space_extra_tags) + tags = concat(["env:${var.environment}", "type:system", "provider:disk", "resource:generic", "team:claranet", "created-by:terraform"], var.disk_space_extra_tags) } resource "datadog_monitor" "disk_space_forecast" { -count = var.disk_space_forecast_enabled == "true" ? 1 : 0 -name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk Space usage could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" -message = coalesce(var.disk_space_forecast_message, var.message) -type = "query alert" + count = var.disk_space_forecast_enabled == "true" ? 1 : 0 + name = "${var.prefix_slug == "" ? "" : "[${var.prefix_slug}]"}[${var.environment}] Disk Space usage could reach {{#is_alert}}{{threshold}}%%{{/is_alert}} in a near future" + message = coalesce(var.disk_space_forecast_message, var.message) + type = "query alert" query = < Date: Wed, 3 Jul 2019 18:24:05 +0200 Subject: [PATCH 24/26] MON-459 regenerate readme now terraform fmt works --- caas/kubernetes/ingress/vts/README.md | 2 +- caas/kubernetes/node/README.md | 6 +++++- caas/kubernetes/workload/README.md | 4 +++- cloud/aws/alb/README.md | 4 +++- cloud/aws/apigateway/README.md | 3 ++- cloud/aws/elasticache/common/README.md | 4 +++- cloud/aws/elasticache/redis/README.md | 2 ++ cloud/aws/elasticsearch/README.md | 3 ++- cloud/aws/elb/README.md | 4 +++- cloud/aws/rds/common/README.md | 1 + cloud/azure/apimanagement/README.md | 2 ++ cloud/azure/app-services/README.md | 4 +++- cloud/azure/cosmosdb/README.md | 4 +++- cloud/azure/eventgrid/README.md | 1 + cloud/azure/eventhub/README.md | 1 + cloud/azure/functions/README.md | 3 ++- cloud/azure/iothubs/README.md | 14 ++++++++++---- cloud/azure/keyvault/README.md | 3 ++- cloud/azure/mysql/README.md | 2 ++ cloud/azure/postgresql/README.md | 4 +++- cloud/azure/redis/README.md | 2 ++ cloud/azure/serverfarms/README.md | 3 ++- cloud/azure/servicebus/README.md | 4 +++- cloud/azure/sql-database/README.md | 6 ++++-- cloud/azure/sql-elasticpool/README.md | 1 + cloud/azure/storage/README.md | 8 ++++++-- cloud/azure/stream-analytics/README.md | 4 +++- cloud/azure/virtual-machine/README.md | 3 ++- cloud/gcp/big-query/README.md | 6 +++++- cloud/gcp/cloud-sql/common/README.md | 5 +++-- cloud/gcp/gce/instance/README.md | 1 + cloud/gcp/lb/README.md | 4 +++- database/elasticsearch/README.md | 20 +++++++++++++++----- database/mongodb/README.md | 2 ++ database/mysql/README.md | 8 ++++++-- database/postgresql/README.md | 3 ++- database/redis/README.md | 8 ++++++-- middleware/nginx/README.md | 2 +- middleware/php-fpm/README.md | 2 +- system/generic/README.md | 4 +++- 40 files changed, 125 insertions(+), 42 deletions(-) diff --git a/caas/kubernetes/ingress/vts/README.md b/caas/kubernetes/ingress/vts/README.md index ffc144d..27df14b 100644 --- a/caas/kubernetes/ingress/vts/README.md +++ b/caas/kubernetes/ingress/vts/README.md @@ -16,8 +16,8 @@ module "datadog-monitors-caas-kubernetes-ingress-vts" { Creates DataDog monitors with the following checks: -- Nginx Ingress 5xx errors - Nginx Ingress 4xx errors +- Nginx Ingress 5xx errors ## Inputs diff --git a/caas/kubernetes/node/README.md b/caas/kubernetes/node/README.md index 99bdb20..d310f53 100644 --- a/caas/kubernetes/node/README.md +++ b/caas/kubernetes/node/README.md @@ -17,11 +17,15 @@ module "datadog-monitors-caas-kubernetes-node" { Creates DataDog monitors with the following checks: - Kubernetes Node Disk pressure +- Kubernetes Node Frequent unregister net device - Kubernetes Node Kubelet API does not respond -- Kubernetes Node volume space usage - Kubernetes Node Kubelet sync loop that updates containers does not work +- Kubernetes Node Memory pressure +- Kubernetes Node not ready - Kubernetes Node Out of disk +- Kubernetes Node unschedulable - Kubernetes Node volume inodes usage +- Kubernetes Node volume space usage ## Inputs diff --git a/caas/kubernetes/workload/README.md b/caas/kubernetes/workload/README.md index 658cf2a..09c8b0a 100644 --- a/caas/kubernetes/workload/README.md +++ b/caas/kubernetes/workload/README.md @@ -16,9 +16,11 @@ module "datadog-monitors-caas-kubernetes-workload" { Creates DataDog monitors with the following checks: +- Kubernetes Available replicas +- Kubernetes cronjob scheduling failed - Kubernetes Current replicas - Kubernetes job failed -- Kubernetes cronjob scheduling failed +- Kubernetes Ready replicas ## Inputs diff --git a/cloud/aws/alb/README.md b/cloud/aws/alb/README.md index cffe389..0fc721d 100644 --- a/cloud/aws/alb/README.md +++ b/cloud/aws/alb/README.md @@ -17,9 +17,11 @@ module "datadog-monitors-cloud-aws-alb" { Creates DataDog monitors with the following checks: - ALB healthy instances -- ALB target HTTP code 5xx +- ALB HTTP code 4xx +- ALB HTTP code 5xx - ALB latency - ALB target HTTP code 4xx +- ALB target HTTP code 5xx ## Inputs diff --git a/cloud/aws/apigateway/README.md b/cloud/aws/apigateway/README.md index dcf77da..9da0102 100644 --- a/cloud/aws/apigateway/README.md +++ b/cloud/aws/apigateway/README.md @@ -16,8 +16,9 @@ module "datadog-monitors-cloud-aws-apigateway" { Creates DataDog monitors with the following checks: -- API Gateway latency +- API Gateway HTTP 4xx errors - API Gateway HTTP 5xx errors +- API Gateway latency ## Inputs diff --git a/cloud/aws/elasticache/common/README.md b/cloud/aws/elasticache/common/README.md index 5eec859..4cacdd6 100644 --- a/cloud/aws/elasticache/common/README.md +++ b/cloud/aws/elasticache/common/README.md @@ -16,10 +16,12 @@ module "datadog-monitors-cloud-aws-elasticache-common" { Creates DataDog monitors with the following checks: +- Elasticache connections - Elasticache eviction -- Elasticache free memory - Elasticache evictions is growing +- Elasticache free memory - Elasticache max connections reached +- Elasticache swap ## Inputs diff --git a/cloud/aws/elasticache/redis/README.md b/cloud/aws/elasticache/redis/README.md index 2ee8c4a..e3d6d8b 100644 --- a/cloud/aws/elasticache/redis/README.md +++ b/cloud/aws/elasticache/redis/README.md @@ -18,6 +18,8 @@ Creates DataDog monitors with the following checks: - Elasticache redis cache hit ratio - Elasticache redis CPU +- Elasticache redis is receiving no commands +- Elasticache redis replication lag ## Inputs diff --git a/cloud/aws/elasticsearch/README.md b/cloud/aws/elasticsearch/README.md index 2c227fc..ae41141 100644 --- a/cloud/aws/elasticsearch/README.md +++ b/cloud/aws/elasticsearch/README.md @@ -18,8 +18,9 @@ module "datadog-monitors-cloud-aws-elasticsearch" { Creates DataDog monitors with the following checks: -- ElasticSearch cluster status is not green +- ElasticSearch cluster CPU high - ElasticSearch cluster free storage space +- ElasticSearch cluster status is not green ## Inputs diff --git a/cloud/aws/elb/README.md b/cloud/aws/elb/README.md index 746a396..430ae50 100644 --- a/cloud/aws/elb/README.md +++ b/cloud/aws/elb/README.md @@ -16,9 +16,11 @@ module "datadog-monitors-cloud-aws-elb" { Creates DataDog monitors with the following checks: +- ELB 4xx errors too high +- ELB 5xx errors too high +- ELB backend 4xx errors too high - ELB backend 5xx errors too high - ELB healthy instances -- ELB 4xx errors too high - ELB latency too high ## Inputs diff --git a/cloud/aws/rds/common/README.md b/cloud/aws/rds/common/README.md index 1a130b8..b2402be 100644 --- a/cloud/aws/rds/common/README.md +++ b/cloud/aws/rds/common/README.md @@ -18,6 +18,7 @@ Creates DataDog monitors with the following checks: - RDS instance CPU high - RDS instance free space +- RDS replica lag ## Inputs diff --git a/cloud/azure/apimanagement/README.md b/cloud/azure/apimanagement/README.md index f302ea8..2918228 100644 --- a/cloud/azure/apimanagement/README.md +++ b/cloud/azure/apimanagement/README.md @@ -19,6 +19,8 @@ Creates DataDog monitors with the following checks: - API Management is down - API Management successful requests rate too low - API Management too many failed requests +- API Management too many other requests +- API Management too many unauthorized requests ## Inputs diff --git a/cloud/azure/app-services/README.md b/cloud/azure/app-services/README.md index 5d50cb1..2f25224 100644 --- a/cloud/azure/app-services/README.md +++ b/cloud/azure/app-services/README.md @@ -16,10 +16,12 @@ module "datadog-monitors-cloud-azure-app-services" { Creates DataDog monitors with the following checks: +- App Services HTTP 4xx errors too high +- App Services HTTP 5xx errors too high - App Services HTTP successful responses too low -- App Services response time too high - App Services is down - App Services memory usage +- App Services response time too high ## Inputs diff --git a/cloud/azure/cosmosdb/README.md b/cloud/azure/cosmosdb/README.md index f145b06..e21ffd5 100644 --- a/cloud/azure/cosmosdb/README.md +++ b/cloud/azure/cosmosdb/README.md @@ -16,8 +16,10 @@ module "datadog-monitors-cloud-azure-cosmosdb" { Creates DataDog monitors with the following checks: -- Cosmos DB is down - Cosmos DB 4xx requests rate is high +- Cosmos DB 5xx requests rate is high +- Cosmos DB is down +- Cosmos DB max scaling reached for collection ## Inputs diff --git a/cloud/azure/eventgrid/README.md b/cloud/azure/eventgrid/README.md index 53319c2..03446e8 100644 --- a/cloud/azure/eventgrid/README.md +++ b/cloud/azure/eventgrid/README.md @@ -18,6 +18,7 @@ Creates DataDog monitors with the following checks: - Event Grid no successful message - Event Grid too many failed messages +- Event Grid too many unmatched events ## Inputs diff --git a/cloud/azure/eventhub/README.md b/cloud/azure/eventhub/README.md index 935998f..67d796a 100644 --- a/cloud/azure/eventhub/README.md +++ b/cloud/azure/eventhub/README.md @@ -17,6 +17,7 @@ module "datadog-monitors-cloud-azure-eventhub" { Creates DataDog monitors with the following checks: - Event Hub is down +- Event Hub too many errors - Event Hub too many failed requests ## Inputs diff --git a/cloud/azure/functions/README.md b/cloud/azure/functions/README.md index ab5a674..d74794d 100644 --- a/cloud/azure/functions/README.md +++ b/cloud/azure/functions/README.md @@ -16,8 +16,9 @@ module "datadog-monitors-cloud-azure-functions" { Creates DataDog monitors with the following checks: -- Function App HTTP 5xx errors too high - Function App connections count too high +- Function App HTTP 5xx errors too high +- Function App threads count too high ## Inputs diff --git a/cloud/azure/iothubs/README.md b/cloud/azure/iothubs/README.md index fcc2c21..de92272 100644 --- a/cloud/azure/iothubs/README.md +++ b/cloud/azure/iothubs/README.md @@ -16,14 +16,20 @@ module "datadog-monitors-cloud-azure-iothubs" { Creates DataDog monitors with the following checks: -- IOT Hub Too many d2c telemetry egress invalid -- IOT Hub Too many d2c twin read failure -- IOT Hub Too many jobs failed -- IOT Hub Total devices is wrong +- IOT Hub is down - IOT Hub Too many c2d methods failure +- IOT Hub Too many c2d twin read failure +- IOT Hub Too many c2d twin update failure +- IOT Hub Too many d2c telemetry egress dropped +- IOT Hub Too many d2c telemetry egress invalid +- IOT Hub Too many d2c telemetry egress orphaned - IOT Hub Too many d2c telemetry ingress not sent +- IOT Hub Too many d2c twin read failure - IOT Hub Too many d2c twin update failure +- IOT Hub Too many jobs failed - IOT Hub Too many list_jobs failure +- IOT Hub Too many query_jobs failed +- IOT Hub Total devices is wrong ## Inputs diff --git a/cloud/azure/keyvault/README.md b/cloud/azure/keyvault/README.md index d9735ca..6da9e4d 100644 --- a/cloud/azure/keyvault/README.md +++ b/cloud/azure/keyvault/README.md @@ -16,8 +16,9 @@ module "datadog-monitors-cloud-azure-keyvault" { Creates DataDog monitors with the following checks: -- Key Vault is down +- Key Vault API latency is high - Key Vault API result rate is low +- Key Vault is down ## Inputs diff --git a/cloud/azure/mysql/README.md b/cloud/azure/mysql/README.md index fecb50c..d31b2cf 100644 --- a/cloud/azure/mysql/README.md +++ b/cloud/azure/mysql/README.md @@ -17,6 +17,8 @@ module "datadog-monitors-cloud-azure-mysql" { Creates DataDog monitors with the following checks: - Mysql Server CPU usage +- Mysql Server IO consumption +- Mysql Server memory usage - Mysql Server storage ## Inputs diff --git a/cloud/azure/postgresql/README.md b/cloud/azure/postgresql/README.md index 86bbc5b..daccdee 100644 --- a/cloud/azure/postgresql/README.md +++ b/cloud/azure/postgresql/README.md @@ -17,8 +17,10 @@ module "datadog-monitors-cloud-azure-postgresql" { Creates DataDog monitors with the following checks: - Postgresql Server CPU usage -- Postgresql Server memory usage - Postgresql Server has no connection +- Postgresql Server IO consumption +- Postgresql Server memory usage +- Postgresql Server storage ## Inputs diff --git a/cloud/azure/redis/README.md b/cloud/azure/redis/README.md index 6f4d94c..b8b8ef9 100644 --- a/cloud/azure/redis/README.md +++ b/cloud/azure/redis/README.md @@ -17,6 +17,8 @@ module "datadog-monitors-cloud-azure-redis" { Creates DataDog monitors with the following checks: - Redis {{name}} is down +- Redis processor time too high +- Redis server load too high - Redis too many evictedkeys ## Inputs diff --git a/cloud/azure/serverfarms/README.md b/cloud/azure/serverfarms/README.md index 973460e..15a4e7c 100644 --- a/cloud/azure/serverfarms/README.md +++ b/cloud/azure/serverfarms/README.md @@ -16,8 +16,9 @@ module "datadog-monitors-cloud-azure-serverfarms" { Creates DataDog monitors with the following checks: -- Serverfarm is down - Serverfarm CPU percentage is too high +- Serverfarm is down +- Serverfarm memory percentage is too high ## Inputs diff --git a/cloud/azure/servicebus/README.md b/cloud/azure/servicebus/README.md index 8a239e4..9021cc2 100644 --- a/cloud/azure/servicebus/README.md +++ b/cloud/azure/servicebus/README.md @@ -16,8 +16,10 @@ module "datadog-monitors-cloud-azure-servicebus" { Creates DataDog monitors with the following checks: -- Service Bus is down - Service Bus has no active connection +- Service Bus is down +- Service Bus server errors rate is high +- Service Bus user errors rate is high ## Inputs diff --git a/cloud/azure/sql-database/README.md b/cloud/azure/sql-database/README.md index 42d19c2..585628f 100644 --- a/cloud/azure/sql-database/README.md +++ b/cloud/azure/sql-database/README.md @@ -16,9 +16,11 @@ module "datadog-monitors-cloud-azure-sql-database" { Creates DataDog monitors with the following checks: -- SQL Database Deadlocks too high -- SQL Database is down - SQL Database CPU too high +- SQL Database Deadlocks too high +- SQL Database DTU Consumption too high +- SQL Database high disk usage +- SQL Database is down ## Inputs diff --git a/cloud/azure/sql-elasticpool/README.md b/cloud/azure/sql-elasticpool/README.md index a6f1ebb..7e510d8 100644 --- a/cloud/azure/sql-elasticpool/README.md +++ b/cloud/azure/sql-elasticpool/README.md @@ -17,6 +17,7 @@ module "datadog-monitors-cloud-azure-sql-elasticpool" { Creates DataDog monitors with the following checks: - SQL Elastic Pool CPU too high +- SQL Elastic Pool DTU Consumption too high - SQL Elastic Pool high disk usage ## Inputs diff --git a/cloud/azure/storage/README.md b/cloud/azure/storage/README.md index c031622..3a3993f 100644 --- a/cloud/azure/storage/README.md +++ b/cloud/azure/storage/README.md @@ -17,10 +17,14 @@ module "datadog-monitors-cloud-azure-storage" { Creates DataDog monitors with the following checks: - Azure Storage is down -- Azure Storage too many authorization errors -- Azure Storage too many network errors - Azure Storage too few successful requests +- Azure Storage too high end to end latency +- Azure Storage too many authorization errors +- Azure Storage too many client_other errors +- Azure Storage too many network errors +- Azure Storage too many server_other errors - Azure Storage too many throttling errors +- Azure Storage too many timeout errors ## Inputs diff --git a/cloud/azure/stream-analytics/README.md b/cloud/azure/stream-analytics/README.md index 3b913be..c447a24 100644 --- a/cloud/azure/stream-analytics/README.md +++ b/cloud/azure/stream-analytics/README.md @@ -17,8 +17,10 @@ module "datadog-monitors-cloud-azure-stream-analytics" { Creates DataDog monitors with the following checks: - Stream Analytics is down -- Stream Analytics too many runtime errors - Stream Analytics streaming units utilization too high +- Stream Analytics too many conversion errors +- Stream Analytics too many failed requests +- Stream Analytics too many runtime errors ## Inputs diff --git a/cloud/azure/virtual-machine/README.md b/cloud/azure/virtual-machine/README.md index 77f5b2f..1980300 100644 --- a/cloud/azure/virtual-machine/README.md +++ b/cloud/azure/virtual-machine/README.md @@ -16,8 +16,9 @@ module "datadog-monitors-cloud-azure-virtual-machine" { Creates DataDog monitors with the following checks: -- Virtual Machine is unreachable - Virtual Machine CPU usage +- Virtual Machine credit CPU +- Virtual Machine is unreachable ## Inputs diff --git a/cloud/gcp/big-query/README.md b/cloud/gcp/big-query/README.md index 49ca366..193b766 100644 --- a/cloud/gcp/big-query/README.md +++ b/cloud/gcp/big-query/README.md @@ -18,9 +18,13 @@ Creates DataDog monitors with the following checks: - GCP Big Query Available Slots - GCP Big Query Concurrent Queries -- GCP Big Query Uploaded Bytes Billed - GCP Big Query Execution Time +- GCP Big Query Scanned Bytes Billed +- GCP Big Query Scanned Bytes - GCP Big Query Stored Bytes +- GCP Big Query Table Count +- GCP Big Query Uploaded Bytes Billed +- GCP Big Query Uploaded Bytes ## Inputs diff --git a/cloud/gcp/cloud-sql/common/README.md b/cloud/gcp/cloud-sql/common/README.md index 6916d06..96fec35 100644 --- a/cloud/gcp/cloud-sql/common/README.md +++ b/cloud/gcp/cloud-sql/common/README.md @@ -17,10 +17,11 @@ module "datadog-monitors-cloud-gcp-cloud-sql-common" { Creates DataDog monitors with the following checks: - Cloud SQL CPU Utilization -- Cloud SQL Failover Unavailable -- Cloud SQL Memory Utilization +- Cloud SQL Disk Utilization forecast - Cloud SQL Disk Utilization +- Cloud SQL Failover Unavailable - Cloud SQL Memory Utilization forecast +- Cloud SQL Memory Utilization ## Inputs diff --git a/cloud/gcp/gce/instance/README.md b/cloud/gcp/gce/instance/README.md index ad30770..619649a 100644 --- a/cloud/gcp/gce/instance/README.md +++ b/cloud/gcp/gce/instance/README.md @@ -18,6 +18,7 @@ Creates DataDog monitors with the following checks: - Compute Engine instance CPU Utilization - Compute Engine instance Disk Throttled Bps +- Compute Engine instance Disk Throttled OPS ## Inputs diff --git a/cloud/gcp/lb/README.md b/cloud/gcp/lb/README.md index 304d8eb..0501fd2 100644 --- a/cloud/gcp/lb/README.md +++ b/cloud/gcp/lb/README.md @@ -17,8 +17,10 @@ module "datadog-monitors-cloud-gcp-lb" { Creates DataDog monitors with the following checks: - GCP LB 4xx errors -- GCP LB Requests count increased abruptly - GCP LB 5xx errors +- GCP LB bucket backend latency +- GCP LB Requests count increased abruptly +- GCP LB service backend latency ## Inputs diff --git a/database/elasticsearch/README.md b/database/elasticsearch/README.md index 751100a..e92f8ee 100644 --- a/database/elasticsearch/README.md +++ b/database/elasticsearch/README.md @@ -17,16 +17,26 @@ module "datadog-monitors-database-elasticsearch" { Creates DataDog monitors with the following checks: - Elasticsearch average index flushing to disk latency -- Elasticsearch change alert on the number of currently active queries -- Elasticsearch change alert on the number of request cache evictions -- ElasticSearch Cluster has unassigned shards -- ElasticSearch does not respond -- Elasticsearch JVM memory Old usage +- Elasticsearch average indexing time by document - Elasticsearch average Old-generation garbage collections latency +- Elasticsearch average search fetch latency +- Elasticsearch average search query latency +- Elasticsearch average Young-generation garbage collections latency - Elasticsearch change alert on the average time spent by tasks in the queue +- Elasticsearch change alert on the number of currently active queries +- Elasticsearch change alert on the number of query cache evictions +- Elasticsearch change alert on the number of request cache evictions - Elasticsearch change alert on the number of search fetches currently running +- Elasticsearch change alert on the total number of evictions from the fielddata cache +- ElasticSearch Cluster has unassigned shards +- ElasticSearch Cluster is initializing shards +- ElasticSearch Cluster is relocating shards - ElasticSearch Cluster status not green +- ElasticSearch does not respond - ElasticSearch free space < 10% +- Elasticsearch JVM HEAP memory usage +- Elasticsearch JVM memory Old usage +- Elasticsearch JVM memory Young usage - Elasticsearch number of current open HTTP connections anomaly detected ## Inputs diff --git a/database/mongodb/README.md b/database/mongodb/README.md index 8d526f4..0fd1cae 100644 --- a/database/mongodb/README.md +++ b/database/mongodb/README.md @@ -17,7 +17,9 @@ module "datadog-monitors-database-mongodb" { Creates DataDog monitors with the following checks: - MongoDB primary state +- MongoDB replication lag - MongoDB secondary missing +- MongoDB too much servers or wrong monitoring config ## Inputs diff --git a/database/mysql/README.md b/database/mysql/README.md index f894048..122f1ce 100644 --- a/database/mysql/README.md +++ b/database/mysql/README.md @@ -16,10 +16,14 @@ module "datadog-monitors-database-mysql" { Creates DataDog monitors with the following checks: -- Mysql Innodb buffer pool efficiency -- Mysql server does not respond +- Mysql Aborted connects - Mysql Connections limit +- Mysql Innodb buffer pool efficiency - Mysql Innodb buffer pool utilization +- Mysql queries changed abnormally +- Mysql server does not respond +- Mysql Slow queries +- Mysql threads changed abnormally ## Inputs diff --git a/database/postgresql/README.md b/database/postgresql/README.md index 729525b..784e152 100644 --- a/database/postgresql/README.md +++ b/database/postgresql/README.md @@ -16,8 +16,9 @@ module "datadog-monitors-database-postgresql" { Creates DataDog monitors with the following checks: -- PostgreSQL server does not respond - PostgreSQL Connections +- PostgreSQL server does not respond +- PostgreSQL too many locks ## Inputs diff --git a/database/redis/README.md b/database/redis/README.md index 7e41f80..ecfdbb7 100644 --- a/database/redis/README.md +++ b/database/redis/README.md @@ -16,12 +16,16 @@ module "datadog-monitors-database-redis" { Creates DataDog monitors with the following checks: +- Redis blocked clients - Redis does not respond +- Redis evicted keys +- Redis expired keys +- Redis hitrate - Redis keyspace seems full (no changes since ${var.keyspace_timeframe}) - Redis latency -- Redis evicted keys -- Redis hitrate +- Redis memory fragmented - Redis memory used +- Redis rejected connections ## Inputs diff --git a/middleware/nginx/README.md b/middleware/nginx/README.md index 2f0e475..8166536 100644 --- a/middleware/nginx/README.md +++ b/middleware/nginx/README.md @@ -16,8 +16,8 @@ module "datadog-monitors-middleware-nginx" { Creates DataDog monitors with the following checks: -- Nginx vhost status does not respond - Nginx dropped connections +- Nginx vhost status does not respond ## Inputs diff --git a/middleware/php-fpm/README.md b/middleware/php-fpm/README.md index f5d7423..f0d05a0 100644 --- a/middleware/php-fpm/README.md +++ b/middleware/php-fpm/README.md @@ -16,8 +16,8 @@ module "datadog-monitors-middleware-php-fpm" { Creates DataDog monitors with the following checks: -- Php-fpm ping url does not respond - Php-fpm busy worker +- Php-fpm ping url does not respond ## Inputs diff --git a/system/generic/README.md b/system/generic/README.md index af09057..bbb65ab 100644 --- a/system/generic/README.md +++ b/system/generic/README.md @@ -18,9 +18,11 @@ module "datadog-monitors-system-generic" { Creates DataDog monitors with the following checks: +- CPU load 5 ratio - CPU usage - Disk inodes usage -- CPU load 5 ratio +- Disk Space usage forecast +- Disk space usage - Usable Memory ## Inputs From f1dfb378548669b5e2b36159bd71181684c36566 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Wed, 3 Jul 2019 18:27:35 +0200 Subject: [PATCH 25/26] MON-459 remove trailing newline for alerting message --- common/alerting-message/main.tf | 1 - 1 file changed, 1 deletion(-) diff --git a/common/alerting-message/main.tf b/common/alerting-message/main.tf index 3c45dd7..20803ce 100644 --- a/common/alerting-message/main.tf +++ b/common/alerting-message/main.tf @@ -10,7 +10,6 @@ $${prepend_text} $${append_text} EOF - vars = { message_alert = var.message_alert message_warning = var.message_warning From 0435f0168d2a911ee6c5972ef1a23cdfc21c65c3 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Thu, 4 Jul 2019 11:53:10 +0200 Subject: [PATCH 26/26] MON-459 update main readme to integrate terraform 0.12 --- README.md | 106 ++++++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 79 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index 0aa27ee..acab7c5 100644 --- a/README.md +++ b/README.md @@ -2,8 +2,7 @@ This repository is used to store all our monitors templates ready to use for generic purpose. - -### How to contribute ? ### +## How to contribute ? ## First, you may refresh your knowledge and look at the [terminology](https://confluence.fr.clara.net/display/DAT/Getting+started). @@ -13,7 +12,7 @@ If you would like to resolve an issue or implement new monitors you must follow After any change you should run `./scripts/auto_update.sh ./` command to make sure all is up to date else the CI pipeline will fail on the branch. -### Important notes ### +## Important notes ## * This repository represents a terraform feature and each first level directory could be imported as a terraform module, you must choose the one(s) you need. * Each of these modules contains the most commons monitors, but they probably do not fulfill all your customer needs @@ -21,54 +20,107 @@ After any change you should run `./scripts/auto_update.sh ./` command to make su * You will find a complete `README.md` on each module, explaining how to use it. * The `alerting-message` module could be used to easily generate a templating message to use by default but it could be used also multiple times to generate messages for specific monitors. -### The DataDog provider ### +## Getting started ## -Before importing some modules, you must define the DataDog provider in your `main.tf` +### Terraform ### + +Version >= 0.12 is required to use these modules of monitors. + +``` +terraform { + required_version = "~> 0.12" +} + +``` + +### DataDog provider ### + +Here is the last tester terraform provider version for datadog but next versions should work too. ``` provider "datadog" { - version = "2.0.2" + version = "2.0.2" # last tested working version - api_key = "${var.datadog_api_key}" - app_key = "${var.datadog_app_key}" + api_key = var.datadog_api_key + app_key = var.datadog_app_key } + ``` -Both of the `datadog_api_key` and `datadog_app_key` are unique to the client. - -### Module declaration example ### - -A quick example of using a set of monitors for a given terraform module: +Both of the `datadog_api_key` and `datadog_app_key` are unique to the each datadog account. You can define them in `terraform.tfvars` file: ``` -variable "oncall_24x7" { - default = "@pagerduty-Public_Cloud_FR_-_Yoda_-_Unibail_HNO" +datadog_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +datadog_app_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" +``` + +### Variables ### + +Some variables need to be declared. + +``` +variable "environment" { + type = string + default = "dev" } -variable "oncall_office_hours" { - default = "@pagerduty-Public_Cloud_FR_-_Yoda_-_Unibail_HO" +variable "datadog_api_key" { + type = string } -variable "oncall_nodata" { - default = "@pagerduty-Public_Cloud_FR_-_Yoda_-_Unibail_HNO" +variable "datadog_app_key" { + type = string +} + +``` + +## Modules declaration example ## + +A quick example of alerting message module declaration: + +``` +locals { + oncall_24x7 = "@pagerduty-MyPagerService_NBH" + oncall_office_hours = "@pagerduty-MyPagerService_BH" } module "datadog-message-alerting" { - source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//common/alerting-message" + source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//common/alerting-message?ref={RELEASE}" - message_alert = "${var.oncall_24x7}" - message_warning = "${var.oncall_office_hours}" - message_nodata = "${var.oncall_nodata}" + message_alert = local.oncall_24x7 + message_warning = local.oncall_office_hours + message_nodata = local.oncall_24x7 } -module "datadog-monitors-my-monitors-set" { - source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//my/monitors/set?ref={revision}" +module "datadog-message-alerting-bh-only" { + source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//common/alerting-message?ref={RELEASE}" - environment = "${var.environment}" - message = "${module.datadog-message-alerting.alerting-message}" + message_alert = local.oncall_office_hours + message_warning = local.oncall_office_hours + message_nodata = local.oncall_office_hours } + +module "datadog-monitors-system-generic" { + source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//system/generic?ref={RELEASE}" + + environment = var.environment + message = module.datadog-message-alerting.alerting-message + + memory_message = module.datadog-message-alerting-bh-only.alerting-message + # Use variables to customize monitors configuration +} + +# Other monitors modules to declare ... +#module "datadog-monitors-my-monitors-set" { +# source = "git::ssh://git@git.fr.clara.net/claranet/pt-monitoring/projects/datadog/terraform/monitors.git//my/monitors/set?ref={RELEASE}" +# +# environment = var.environment +# message = module.datadog-message-alerting.alerting-message +#} + ``` +Replace `{revision}` to the last git tag available on this repository. The `//` is very important, it's a terraform specific syntax used to separate git url and folder path. `my/monitors/set` represents the path to a monitors set sub directory listed below.