Terraform: Create azure service health alert

I just found out, if we create Azure service health alert with Terraform, with below code:

resource "azurerm_monitor_activity_log_alert" "servicehealth" {
  name                = "${var.client_initial}-MCS Maintain Service Health"
  description         = "${var.client_initial}-MCS Maintain Service Health Alerts"
  resource_group_name = var.resource_group_name
  scopes              = [var.scopes]
  criteria {
    category = "ServiceHealth"
  }
  tags = var.tags
  action {
    action_group_id = var.action_group_id
  }
}

When I do terraform apply, it applies fine, but when I check on portal, no region is selected. You can't do the same via portal, if you do via portal, you have to select region or select all regions.

So if deploy via Terraform and no region is selected, does that mean it applies to all regions?

I see on GitHub, more granular control on this is still an open issue https://github.com/terraform-providers/terraform-provider-azurerm/issues/2996


The region will be determined based on

resource_group_name = var.resource_group_name

where resource_group_name requires an instance of azurerm_resource_group:

resource "azurerm_resource_group" "example" {
  name     = "example"
  location = "West Europe"
}

and

location - (Required) The Azure Region where the Resource Group should exist. Changing this forces a new Resource Group to be created.