Not able to create Azure managed certificate for functions

I am trying to create custom domain for Azure function with below code:
resource “azurerm_app_service_custom_hostname_binding” “example” {
hostname = “xyz.abc.com
app_service_name = azurerm_windows_function_app.example.name
resource_group_name = azurerm_resource_group.example.name
}
resource “azurerm_app_service_managed_certificate” “example” {
custom_hostname_binding_id = azurerm_app_service_custom_hostname_binding.example.id
}

resource “azurerm_app_service_certificate_binding” “example” {
hostname_binding_id = azurerm_app_service_custom_hostname_binding.example.id
certificate_id = azurerm_app_service_managed_certificate.example.id
ssl_state = “SniEnabled”
}

while creating azurerm_app_service_managed_certificate, i am getting error “Error: ID was missing the serverFarms element”

There is no serverFarm element in id of “azurerm_app_service_custom_hostname_binding”.

Am i missing something or there is some other way to work with functions to create custom domain.