Skip to content
Merged
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,17 @@ variable "metrics_filter" {
}))
description = "To filter custom metrics you can specify which metrics to include and exclude. For more info, see https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_inc_exc_metrics"
default = []
# TODO: Add variable validation to ensure only include or exclude is in each item - not both
validation {
condition = alltrue([
for item in var.metrics_filter : (
(
(!(try(item.include, null) != null && try(item.exclude, null) != null)) &&
((try(item.include, null) != null && try(item.include, "") != "") || (try(item.exclude, null) != null && try(item.exclude, "") != ""))
)
)
])
error_message = "Each item in 'metrics_filter' must have either 'include' or 'exclude' set (not both, not neither), and the value must not be null or empty."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[] empty list is a valid value, update the error message.

}
}

variable "container_filter" {
Expand Down