在从事件中心触发的经过zip部署的功能应用程序中,该应用程序不一致地触发(仅在调试Azure门户及其后约15分钟后才触发)。
resource "azurerm_function_app" "helloworld" {
name = "helloworld-func"
location = "${azurerm_resource_group.helloworld.location}"
resource_group_name = "${azurerm_resource_group.helloworld.name}"
app_service_plan_id = "${azurerm_app_service_plan.helloworld.id}"
storage_connection_string = "${azurerm_storage_account.helloworld.primary_connection_string}"
version = "~2"
app_settings {
# key must match bindings.connection in functionapp/eventHubsMessages/function.json and must include EntityPath
# bindings.eventHubName in functionapp/eventHubMessages/function.json is purposelly kept empty to avoid overriding the EntityPath in connection string
# see https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-event-hubs#output---configuration
LOGSEVENTHUBCONNECTIONSTRING = "${azurerm_eventhub_authorization_rule.helloworld.primary_connection_string}"
# TODO figure out how to use Azure AD and RBAC to allow the Function App access to the storage blob without a time-based token
WEBSITE_USE_ZIP = "${azurerm_storage_blob.helloworld.url}${data.azurerm_storage_account_sas.helloworld.sas}"
HASH = "${data.archive_file.helloworld.output_base64sha256}"
WEBSITE_NODE_DEFAULT_VERSION = "10.14.1"
}
}
答案 0 :(得分:1)
这是一个众所周知的长期未解决问题,由功能触发器未同步引起(请参见https://github.com/Azure/Azure-Functions/issues/210)
在Terraform中添加此local-exec
的预配器,该预配器使用azure cli来syncfunctiontriggers
效果很好
# required to sync the function trigger (event hub trigger); without, function app will trigger inconsistently
provisioner "local-exec" {
command = "az resource invoke-action --resource-group ${azurerm_resource_group.datadog_logs.name} --action syncfunctiontriggers --name ${azurerm_function_app.datadog_logs.name} --resource-type Microsoft.Web/sites"
}