MON-301 add support for excluding on service check
This commit is contained in:
parent
9c3afce524
commit
50811d98de
@ -14,12 +14,17 @@ variable "filter_tags_use_defaults" {
|
||||
}
|
||||
|
||||
variable "filter_tags_custom" {
|
||||
description = "Tags used for custom filtering when filter_tags_use_defaults is false"
|
||||
description = "Tags used for custom filtering when filter_tags_use_defaults is false (i.e. \"tag1:val1,tag2:val2\")"
|
||||
default = "*"
|
||||
}
|
||||
|
||||
variable "filter_tags_custom_excluded" {
|
||||
description = "Tags excluded for custom filtering when filter_tags_use_defaults is false (i.e. \"tag1:val1,tag2:val2\")"
|
||||
default = ""
|
||||
}
|
||||
|
||||
variable "extra_tags" {
|
||||
description = "Extra optional tags (i.e. [\"tag1:val1\", \"tag2:val2\"])"
|
||||
description = "Extra optional tags added for default filtering when filter_tags_use_defaults is true (i.e. [\"tag1:val1\", \"tag2:val2\"])"
|
||||
type = "list"
|
||||
default = []
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
locals {
|
||||
filters = "${var.filter_tags_use_defaults == "true" ? join(",", compact(concat(split(",", format("dd_monitoring:enabled,dd_%s:enabled,env:%s", var.resource, var.environment)), compact(var.extra_tags)))) : "${var.filter_tags_custom}"}"
|
||||
including = "${var.filter_tags_use_defaults == "true" ? join(",", compact(concat(split(",", format("dd_monitoring:enabled,dd_%s:enabled,env:%s", var.resource, var.environment)), compact(var.extra_tags)))) : "${var.filter_tags_custom}"}"
|
||||
excluding = "${join(",", compact(split(",", "${var.filter_tags_custom_excluded}")))}"
|
||||
}
|
||||
|
||||
@ -1,9 +0,0 @@
|
||||
output "query_alert" {
|
||||
description = "The full filtering pattern including parentheses for service check monitor type"
|
||||
value = "{${local.filters}}"
|
||||
}
|
||||
|
||||
output "service_check" {
|
||||
description = "The full filtering pattern including braces for query alert monitor type"
|
||||
value = "(\"${replace(local.filters, ",", "\",\"")}\")"
|
||||
}
|
||||
10
common/filter-tags/outputs.tf
Normal file
10
common/filter-tags/outputs.tf
Normal file
@ -0,0 +1,10 @@
|
||||
output "query_alert" {
|
||||
description = "The full filtering pattern including parentheses for service check monitor type"
|
||||
value = "{${join(",", compact(concat(list(local.including), formatlist("!%s", compact(split(",", local.excluding))))))}}"
|
||||
}
|
||||
|
||||
output "service_check" {
|
||||
description = "The full filtering pattern including braces for query alert monitor type"
|
||||
#value = "over.(\"${replace(local.including, ",", "\",\"")}\").exclude(\"${replace(local.excluding, ",", "\",\"")}\")"
|
||||
value = ".over(\"${replace(local.including, ",", "\",\"")}\")${local.excluding == "" ? "" : ".exclude(\"${replace(local.excluding, ",", "\",\"")}\")"}"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user