From 3cbd81df8af7fd08c6b40fb85908b86d68f4fc02 Mon Sep 17 00:00:00 2001 From: Quentin Manfroi Date: Fri, 3 Nov 2017 20:10:03 +0100 Subject: [PATCH] MON-79 add subscription_id to filter on --- cloud/azure/storage/README.md | 3 ++- cloud/azure/storage/inputs.tf | 5 +++++ cloud/azure/storage/monitors-azure-storage.tf | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/cloud/azure/storage/README.md b/cloud/azure/storage/README.md index a24bcd8..bac3ac2 100644 --- a/cloud/azure/storage/README.md +++ b/cloud/azure/storage/README.md @@ -9,8 +9,8 @@ module "datadog-monitors-azure-storage" { source = "git::ssh://git@bitbucket.org/morea/terraform.feature.datadog.git//cloud/azure/storage?ref={revision}" message = "${module.datadog-message-alerting.alerting-message}" - environment = "${var.environment}" + subscription_id = "${var.subscription_id}" } ``` @@ -35,6 +35,7 @@ Inputs |------|-------------|:----:|:-----:|:-----:| | delay | Delay in seconds for the metric evaluation | string | `600` | no | | environment | Architecture environment | string | - | yes | +| subscription_id | Azure account id used as filter for monitors | string | - | yes | | message | Message sent when a monitor is triggered | string | - | yes | | use_filter_tags | Filter the data with service tags if true | string | `true` | no | | availability_threshold_critical | Minimum threshold of availability | string | `90` | no | diff --git a/cloud/azure/storage/inputs.tf b/cloud/azure/storage/inputs.tf index bb21f9a..e77079d 100644 --- a/cloud/azure/storage/inputs.tf +++ b/cloud/azure/storage/inputs.tf @@ -4,6 +4,11 @@ variable "environment" { type = "string" } +variable "subscription_id" { + description = "Azure account id used as filter for monitors" + type = "string" +} + variable "provider" { description = "Cloud provider which the monitor and its based metric depend on" type = "string" diff --git a/cloud/azure/storage/monitors-azure-storage.tf b/cloud/azure/storage/monitors-azure-storage.tf index 388706c..671eb42 100644 --- a/cloud/azure/storage/monitors-azure-storage.tf +++ b/cloud/azure/storage/monitors-azure-storage.tf @@ -2,7 +2,7 @@ data "template_file" "filter" { template = "$${filter}" vars { - filter = "${var.use_filter_tags == "true" ? format("dd_monitoring:enabled,dd_azure_storage:enabled,env:%s", var.environment) : "*"}" + filter = "${var.use_filter_tags == "true" ? format("dd_monitoring:enabled,dd_azure_storage:enabled,env:%s", var.environment) : "subscription_id:${var.subscription_id}"}" } }