mar*_*ark 5 azure azure-application-insights terraform azure-web-app-service
我查看了azurerm_app_service和azurerm_application_insights的文档,但我没有找到将它们联系起来的方法。
然而,在门户的应用服务页面上有一个指向 Application Insights 的链接,目前是灰色的:

那么,如何使用 terraform 启用它?
小智 10
您需要进行大量的应用程序设置才能使其按预期正常工作。为了使其全部正常工作,我必须添加以下内容:
目前看来,使用 Terraform 启用应用程序洞察还无法正常工作。有一个功能请求:将 azurerm_application_insights 附加到 Github 中的 azurerm_app_service。
可能可以在资源tag上设置一个azurerm_application_insights,
resource "azurerm_application_insights" "test" {
tags {
"hidden-link:/subscriptions/<subscription id>/resourceGroups/<rg name>/providers/Microsoft.Web/sites/<site name>": "Resource"
}
}
Run Code Online (Sandbox Code Playgroud)
通常,如果您需要在应用程序服务中启用应用程序洞察组件,则需要将APPINSIGHTS_*环境变量添加到app_settingsWeb 应用程序的环境变量中。
例如,
app_settings {
"APPINSIGHTS_INSTRUMENTATIONKEY" = "${azurerm_application_insights.test.instrumentation_key}"
}
Run Code Online (Sandbox Code Playgroud)
请参阅参数参考,即使它是关于 Azure 函数的。
参考:
https://www.olivercoding.com/2018-06-24-terraform/
https://github.com/terraform-providers/terraform-provider-azurerm/issues/2457
| 归档时间: |
|
| 查看次数: |
3046 次 |
| 最近记录: |