diff --git a/README.md b/README.md index 5cadf39..c54a411 100644 --- a/README.md +++ b/README.md @@ -102,6 +102,7 @@ The `//` is very important, it's a terraform specific syntax used to separate gi - [iothubs](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/iothubs/) - [keyvault](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/keyvault/) - [redis](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/redis/) + - [serverfarms](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/serverfarms/) - [servicebus](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/servicebus/) - [sql-database](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/sql-database/) - [storage](https://bitbucket.org/morea/terraform.feature.datadog/src/master/cloud/azure/storage/) diff --git a/cloud/azure/serverfarms/inputs.tf b/cloud/azure/serverfarms/inputs.tf new file mode 100644 index 0000000..e620b7d --- /dev/null +++ b/cloud/azure/serverfarms/inputs.tf @@ -0,0 +1,140 @@ +# Global Terraform +variable "environment" { + description = "Architecture environment" + type = "string" +} + +# Global DataDog +variable "message" { + description = "Message sent when a Redis monitor is triggered" +} + +variable "evaluation_delay" { + description = "Delay in seconds for the metric evaluation" + default = 900 +} + +variable "new_host_delay" { + description = "Delay in seconds before monitor new resource" + default = 300 +} + +variable "filter_tags_use_defaults" { + description = "Use default filter tags convention" + default = "true" +} + +variable "filter_tags_custom" { + description = "Tags used for custom filtering when filter_tags_use_defaults is false" + default = "*" +} + +# Azure serverfarms specific variables + +# Status +variable "status_enabled" { + description = "Flag to enable the serverfarms status monitor" + type = "string" + default = "true" +} + +variable "status_message" { + description = "Custom message for serverfarm status monitor" + type = "string" +} + +variable "status_silenced" { + type = "map" + description = "Groups to mute for serverfarm status monitor" + default = {} +} + +variable "status_extra_tags" { + description = "Extra tags for Redis status monitor" + type = "list" + default = [] +} + +variable "status_time_aggregator" { + description = "Monitor aggregator for serverfarms status [available values: min, max or avg]" + type = "string" + default = "max" +} + +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" + default = "last_5m" +} + +# CPU percentage +variable "cpu_percentage_enabled" { + description = "Flag to enable the serverfarms cpu_percentage monitor" + type = "string" + default = "true" +} + +variable "cpu_percentage_message" { + description = "Custom message for serverfarm cpu_percentage monitor" + type = "string" +} + +variable "cpu_percentage_silenced" { + type = "map" + description = "Groups to mute for serverfarm cpu_percentage monitor" + default = {} +} + +variable "cpu_percentage_extra_tags" { + description = "Extra tags for Redis cpu_percentage monitor" + type = "list" + default = [] +} + +variable "cpu_percentage_time_aggregator" { + description = "Monitor aggregator for serverfarms cpu_percentage [available values: min, max or avg]" + type = "string" + default = "max" +} + +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" + default = "last_5m" +} + +# Memory percentage +variable "memory_percentage_enabled" { + description = "Flag to enable the serverfarms memory_percentage monitor" + type = "string" + default = "true" +} + +variable "memory_percentage_message" { + description = "Custom message for serverfarm memory_percentage monitor" + type = "string" +} + +variable "memory_percentage_silenced" { + type = "map" + description = "Groups to mute for serverfarm memory_percentage monitor" + default = {} +} + +variable "memory_percentage_extra_tags" { + description = "Extra tags for Redis memory_percentage monitor" + type = "list" + default = [] +} + +variable "memory_percentage_time_aggregator" { + description = "Monitor aggregator for serverfarms memory_percentage [available values: min, max or avg]" + type = "string" + default = "max" +} + +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" + default = "last_5m" +} diff --git a/cloud/azure/serverfarms/monitor-azure-serverfarms.tf b/cloud/azure/serverfarms/monitor-azure-serverfarms.tf new file mode 100644 index 0000000..19663bf --- /dev/null +++ b/cloud/azure/serverfarms/monitor-azure-serverfarms.tf @@ -0,0 +1,83 @@ +resource "datadog_monitor" "status" { + count = "${var.status_enabled ? 1 : 0}" + name = "[${var.environment} Serverfarm {{name}} is down]" + message = "${coalesce(var.status_message, var.message)}" + + query = <