MON-273 add optional extra tags support

This commit is contained in:
Quentin Manfroi 2018-08-13 17:17:06 +02:00
parent a7b41f6a53
commit faeb0d13bb
3 changed files with 10 additions and 1 deletions

View File

@ -28,6 +28,7 @@ Creates all kinds of filters tags patterns depending of the monitor type and dir
| Name | Description | Type | Default | Required | | Name | Description | Type | Default | Required |
|------|-------------|:----:|:-----:|:-----:| |------|-------------|:----:|:-----:|:-----:|
| environment | Architecture Environment | string | - | yes | | environment | Architecture Environment | string | - | yes |
| extra_tags | Extra optional tags | list | `<list>` | no |
| filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no | | filter_tags_custom | Tags used for custom filtering when filter_tags_use_defaults is false | string | `*` | no |
| filter_tags_use_defaults | Use default filter tags convention | string | `true` | no | | filter_tags_use_defaults | Use default filter tags convention | string | `true` | no |
| resource | The dedicated tag for the resource | string | - | yes | | resource | The dedicated tag for the resource | string | - | yes |

View File

@ -17,3 +17,11 @@ 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"
default = "*" default = "*"
} }
variable "extra_tags" {
description = "Extra optional tags"
type = "list"
default = []
# Example of value to add optional tags : ["tag1:val1", "tag2:val2"]
}

View File

@ -1,3 +1,3 @@
locals { locals {
filters = "${var.filter_tags_use_defaults == "true" ? format("dd_monitoring:enabled,dd_%s:enabled,env:%s", var.resource, var.environment) : "${var.filter_tags_custom}"}" 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}"}"
} }