我一直在尝试找到一种方法来为我的应用服务/az功能准备一个terraform模板,这样我就可以在通过Terraform创建它们的同时将其连接到应用洞察力。嗯,它起作用了,但应用洞察力显示
将此资源迁移到基于Workspace的Application Insights,以获得对Log Analytics所有功能的支持,包括客户管理的密钥和承诺层。单击此处了解详细信息,只需单击几下即可迁移。
我怎样从terraform中获得它呢?在terraform的文档页面中没有提到这样的设置。感谢你的帮助。下面是az-function的terraform代码
resource "azurerm_linux_function_app" "t_funcapp" {
name = "t-function-app"
location = local.resource_location
resource_group_name = local.resource_group_name
service_plan_id = azurerm_service_plan.t_app_service_plan.id
storage_account_name = azurerm_storage_account.t_funcstorage.name
storage_account_access_key = azurerm_storage_account.t_funcstorage.primary_access_key
site_config {
application_stack {
java_version = "11"
}
remote_debugging_enabled = false
ftps_state = "AllAllowed"
}
app_settings = {
APPINSIGHTS_INSTRUMENTATIONKEY = "${azurerm_application_insights.t_appinsights.instrumentation_key}"
}
depends_on = [
azurerm_resource_group.t_rg,
azurerm_service_plan.t_app_service_plan,
azurerm_storage_account.t_funcstorage,
azurerm_application_insights.t_appinsights
]
}
下面是应用洞察的terraform代码
resource "azurerm_application_insights" "t_appinsights" {
name = "t-appinsights"
location = local.resource_location
resource_group_name = local.resource_group_name
application_type = "web"
depends_on = [
azurerm_log_analytics_workspace.t_workspace
]
}
output "instrumentation_key" {
value = azurerm_application_insights.t_appinsights.instrumentation_key
}
output "app_id" {
value = azurerm_application_insights.t_appinsights.app_id
}
1条答案
按热度按时间jxct1oxe1#
您必须创建日志分析工作区并将其添加到应用程序洞察中。
例如
希望这有帮助!