I am using the following code to create an azure function app but I am experiencing the Azure function runtime is unreachable error.
resource "azurerm_resource_group" "main" {
name = "rg-nonprod-${random_string.suffix.result}"
location = "centralus"
}
resource "azurerm_windows_function_app" "main" {
name = var.name
resource_group_name = azurerm_resource_group.main.name
location = “centralus”
storage_account_name = var.storage_account_name
storage_uses_managed_identity = true
service_plan_id = var.service_plan_id
virtual_network_subnet_id = var.virtual_snet_id
https_only = true
client_certificate_enabled = true
client_certificate_mode = "Required"
key_vault_reference_identity_id = var.key_vault_reference_identity_id
identity {
type = "UserAssigned"
identity_ids = var.identity_ids
}
tags = var.tags
app_settings = {
WEBSITE_CONTENTOVERVNET = "1"
WEBSITE_CONTENTSHARE = lower(var.name)
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING = var.storage_account_primary_connection_string
WEBSITE_RUN_FROM_PACKAGE = "1"
FUNCTIONS_WORKER_RUNTIME = "node"
APPINSIGHTS_INSTRUMENTATIONKEY = var.application_insights_instrumentation_key
AzureWebJobsStorage = var.storage_account_primary_connection_string
}
site_config {
application_stack {
node_version = "~18"
}
ip_restriction {
virtual_network_subnet_id = var.virtual_snet_id
}
}
functions_extension_version = "~4"
}