Too many criteria blocks

Hi Team,

I’m trying to create azure resource health monitor and i need to monitor particular resource types ( Virtual machine , storage, key vault ). Below is my code. when i execute i’m getting error “Too many criteria blocks”

main.tf
resource “azurerm_monitor_activity_log_alert” “resources_health” {

count = var.resourceHealthAlerts == true ? 1 : 0

name = join(“-”, [var.netcoolClass,“activity-log-alert-res”,var.opEnvironment])

resource_group_name = “ENG_NEU_Monitoring”

tags = local.tags

scopes = [join(“/”, [“/subscriptions”, var.subscriptionId])]

description = “Subscription-wide resource health activity log alert.”

dynamic “criteria” {

for_each = var.criteria

content {

resource_type =  criteria.value.resource_type

category=  criteria.value.category

}

}

action {

action_group_id = var.actionGroupId1

webhook_properties = ({

  IncludeSearchResults = true

  Severity             = "2"

  Summary              = "Subscription-wide resource health activity log alert."

  SupportText          = "Subscription-wide resource health activity log alert."

  Type                 = "1"

  WorkspaceId          = ""

  schemaId             = "AzureMonitorSearchResult"

})

}

}

lifecycle {

ignore_changes = [

  tags["hostingRestrictions"],

]

}

}

variable.tf
variable “criteria” {

type = map(object({

name = string

description = string

resource_type = string

category = string

}))

default = {

"WORKSPACE" = {

  name           = "WORKSPACE"

  description    = "Monitor workspace resource ResourceHealth"

  resource_type  = "Microsoft.OperationalInsights/workspaces"

  category = "ResourceHealth"

},

"LoadBalancers" = {

  name           = "LoadBalancers"

  description    = "monitor LoadBalancers ResourceHealth"

  resource_type  = "Microsoft.Network/LoadBalancers"

  category = "ResourceHealth"

},

"virtualMachines" = {

  name           = "virtualMachines"

  description    = "Monitor virtualMachines ResourceHealth"

  resource_type  = "Microsoft.Compute/virtualMachines"

  category = "ResourceHealth"

},

"storageAccounts" = {

  name           = "storageAccounts"

  description    = "Monitor storageAccounts ResourceHealth"

  resource_type  = "Microsoft.Storage/storageAccounts"

  category = "ResourceHealth"

}

}

}

error
│ Error: Too many criteria blocks

│ on main.tf line 35, in resource “azurerm_monitor_activity_log_alert” “resources_health”:

│ 35: content {


can anyone provide me config file to monitor more than 2 particular resource types need to add.