Skip to content

Commit 9f559cf

Browse files
authored
feat: added container filtering for cloud monitoring agents using new variable cloud_monitoring_container_filter (#204)
1 parent b4b6491 commit 9f559cf

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

solutions/agents/main.tf

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ data "ibm_container_cluster_config" "cluster_config" {
1111

1212
module "observability_agents" {
1313
source = "terraform-ibm-modules/observability-agents/ibm"
14-
version = "2.0.1"
14+
version = "2.1.0"
1515
cluster_id = var.cluster_id
1616
cluster_resource_group_id = var.cluster_resource_group_id
1717
cluster_config_endpoint_type = var.cluster_config_endpoint_type
@@ -23,6 +23,7 @@ module "observability_agents" {
2323
cloud_monitoring_access_key = var.cloud_monitoring_access_key
2424
cloud_monitoring_secret_name = var.prefix != null ? "${var.prefix}-${var.cloud_monitoring_secret_name}" : var.cloud_monitoring_secret_name
2525
cloud_monitoring_metrics_filter = var.cloud_monitoring_metrics_filter
26+
cloud_monitoring_container_filter = var.cloud_monitoring_container_filter
2627
cloud_monitoring_agent_tags = var.cloud_monitoring_agent_tags
2728
cloud_monitoring_instance_region = var.cloud_monitoring_instance_region
2829
cloud_monitoring_agent_tolerations = var.cloud_monitoring_agent_tolerations

solutions/agents/variables.tf

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,16 @@ variable "cloud_monitoring_metrics_filter" {
110110
}))
111111
description = "To filter on custom metrics, specify the IBM Cloud Monitoring metrics to include or exclude. [Learn more](https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_inc_exc_metrics)"
112112
default = [] # [{ type = "exclude", name = "metricA.*" }, { type = "include", name = "metricB.*" }]
113-
validation {
114-
condition = length(var.cloud_monitoring_metrics_filter) == 0 || can(regex("^(include|exclude)$", var.cloud_monitoring_metrics_filter[0].type))
115-
error_message = "The specified `type` for the `cloud_monitoring_metrics_filter` is not valid. Specify either `include` or `exclude`. If the value for `type` is not specified, no metrics are included or excluded."
116-
}
113+
}
114+
115+
variable "cloud_monitoring_container_filter" {
116+
type = list(object({
117+
type = string
118+
parameter = string
119+
name = string
120+
}))
121+
description = "To filter custom containers, specify which containers to include or exclude from metrics collection for the cloud monitoring agent. See https://cloud.ibm.com/docs/monitoring?topic=monitoring-change_kube_agent#change_kube_agent_filter_data."
122+
default = [] # [{ type = "exclude", parameter = "kubernetes.namespace.name", name = "kube-system" }]
117123
}
118124

119125
variable "cloud_monitoring_agent_tags" {

0 commit comments

Comments
 (0)