Azure Heartbeat Metric Alert Rule not working

Brief:
Created an Azure VM Heartbeat Alert Rule using below Terraform code But alert not triggered as expected.
##########Terraform Code##################

Metric Alert for Heartbeat

resource “azurerm_monitor_metric_alert” “heartbeat” {
name = “Test - Heartbeat Alert”
#location = “global”
resource_group_name = var.resource_group_name
scopes = [azurerm_log_analytics_workspace.law.id]
description = “Test - Heartbeat Alert”
enabled = var.azure_alerts_enabled
auto_mitigate = true
frequency = “PT1M”
window_size = “PT5M”
severity = 3
criteria {
metric_namespace = “Microsoft.OperationalInsights/workspaces”
metric_name = “Heartbeat”
aggregation = “Count”
operator = “LessThanOrEqual”
threshold = 0

dimension {
  name     = "Computer"
  operator = "Include"
  values   = ["*"]
}

}
}

############################

Troubleshooting:
VM Heartbeat metric data will be visible (in Azure Metric Blade) if we have Alert Rule created which will consume that data. But in our case we already created Alert Rule.

Deleted the Alert Rule created by Terraform and Created same Alert Rule using Azure Portal. Within minutes we could see Heartbeat Metric data in Metric Blade

Compared Json code for both alerts (via Terraform and via Azure Portal) and find the difference as below:

Alert Created via Terraform has below line under Criteria:
“odata.type”: “Microsoft.Azure.Monitor.MultipleResourceMultipleMetricCriteria”

Alert Created via Azure Portal has below line under Criteria:
“odata.type”: “Microsoft.Azure.Monitor.SingleResourceMultipleMetricCriteria”

Appreciate, if someone could help me understand how to fix this in Terraform code to make it work?

regards, Ravi
AzurePortalAlertjSON.txt (1.7 KB)
TerraformAlertjSON.txt (1.7 KB)