While creating dynatrace custom anomaly getting error "message": "The metric dimension is of the wrong filter type.",

Error is as below

│ Error: {
│   "code": 400,
│   "message": "Constraints violated.",
│   "constraintViolations": [
│     {
│       "parameterLocation": "PAYLOAD_BODY",
│       "location": "",
│       "message": "The metric dimension is of the wrong filter type.",
│       "path": "metricDimensions[0].filterType"
│     }
│   ]
│ }

main.tf content

locals {

  oft_cfc_k8s_alerts_tmp = concat(
    var.oft_cfc_k8s_hosts_alerts)

}

// flatten the combined vars to create new var of all alerts
// with key as mgmt zone id to loop over
locals {
  oft_cfc_k8s_alerts = flatten([
    for alert_key, value in local.oft_cfc_k8s_alerts_tmp : [
      for mgmt_zone_key in value.mgmt_zone_id : {
        key_id = alert_key
        alert_name  = value.alert_name
        alert_description = value.alert_description
        alert_condition = value.alert_condition
        alerting_on_missing_data = value.alerting_on_missing_data
        aggregation_type = value.aggregation_type
        dealerting_samples = value.dealerting_samples
        description_severity = value.description_severity
        enabled = value.enabled
        metric_id = value.metric_id
        mgmt_zone_id = mgmt_zone_key
        primary_dimension_key = value.primary_dimension_key
        prefix = value.prefix
        severity = value.severity
        samples = value.samples
        threshold = value.threshold
        unit = value.unit
        violating_samples = value.violating_samples
        dimensions = value.dimensions == null ? {} : value.dimensions
      }
    ]
  ])
}

resource "dynatrace_custom_anomalies" "oft_cfc_k8s_alerts" {
  for_each = {
      for value in local.oft_cfc_k8s_alerts : "${value.key_id}.${value.mgmt_zone_id  }" => value
  }
  name = format("%s-%s-%s-%s", each.value.alert_name, each.value.mgmt_zone_id == "-abcd" ? "npn" : "prod" , each.value.description_severity, each.value.prefix)
  description = format("[%s] %s", each.value.description_severity, each.value.alert_description)
  primary_dimension_key = each.value.primary_dimension_key
  enabled = each.value.enabled
  aggregation_type = each.value.aggregation_type
  metric_id = each.value.metric_id
  severity = each.value.severity
  scopes {
    management_zone {
      id = each.value.mgmt_zone_id
    }
  }

  
  strategy {
    static {
      alert_condition = each.value.alert_condition
      alerting_on_missing_data = each.value.alerting_on_missing_data
      dealerting_samples = each.value.dealerting_samples
      samples = each.value.samples
      threshold = each.value.threshold
      unit = each.value.unit
      violating_samples = each.value.violating_samples
    }
  }
  // nested loop for dynamic resources
  dynamic "dimensions" {
    for_each = each.value.dimensions
    content {
      string {
        key = each.value.dimensions.key
        filter {
          operator = "EQUALS"
          value = each.value.dimensions.value
        }
      }
    }
  }
}

Variable.tfvars

oft_cfc_k8s_hosts_alerts = [
  {
    alert_name               = "oft-cfc-k8s-infra-system-hosts-disk-docker-used-alert"
    alert_description        = "SYSTEM_HOSTS_ALERT \n Node name: {entityname} \n Metric name: {metricname} \n Current value is {severity} which is {alert_condition} than threshold vaule of {threshold}. \n\n {dims}"
    alert_condition          = "ABOVE"
    alerting_on_missing_data = false
    aggregation_type         = "AVG"
    dealerting_samples       = "3"
    description_severity     = "CRITICAL"
    enabled                  = true
    mgmt_zone_id             = ["-abcd", "-xyz"]
    metric_id                = "builtin:host.disk.usedPct"
    primary_dimension_key    = "dt.entity.host"
    prefix                   = "13350|12284"
    env                      = "npn"
    severity                 = "CUSTOM_ALERT"
    samples           = "5"
    threshold         = "75"
    unit              = "PERCENT"
    violating_samples = 3
    dimensions = {
      key   = "dt.entity.disk"
      value = "/var/lib/docker"
    }
  },
]```