Error while deploying - parsing the Service ID: the number of segments didn't match using terraform script

While trying to create a new API Policy in All APIs(Global Level):
Planning failed. Terraform encountered an error while generating this plan.
parsing “apim-devtest-trail”: parsing the Service ID: the number of segments didn’t match

│ Expected a Service ID that matched (containing 8 segments):

│ > /subscriptions/12345678-XXXXXXX—123341/resourceGroups/example-resource-group/providers/Microsoft.ApiManagement/service/serviceValue
The following Segments are expected:

│ * Segment 0 - this should be the literal value “subscriptions”
│ * Segment 1 - this should be the UUID of the Azure Subscription
│ * Segment 2 - this should be the literal value “resourceGroups”
│ * Segment 3 - this should be the name of the Resource Group
│ * Segment 4 - this should be the literal value “providers”
│ * Segment 5 - this should be the name of the Resource Provider [for example ‘Microsoft.ApiManagement’]
│ * Segment 6 - this should be the literal value “service”
│ * Segment 7 - this should be the user specified value for this service [for example “serviceValue”]

│ The following Segments were parsed:

│ * Segment 0 - not found
│ * Segment 1 - not found
│ * Segment 2 - not found
│ * Segment 3 - not found
│ * Segment 4 - not found
│ * Segment 5 - not found
│ * Segment 6 - not found
│ * Segment 7 - not found


│ with azurerm_api_management_policy.AllAPIsPolicy,
│ on main.tf line 63, in resource “azurerm_api_management_policy” “AllAPIsPolicy”:
│ 63: api_management_id = var.az_apim_service

Terraform Configuration Files

resource “azurerm_api_management_policy” “sample” {
api_management_id = var.az_apim_service
xml_content = file(“${path.module}/policies/AllAPIs.xml”)
}