forked from hmcts/wa-shared-infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapplication-insights.tf
33 lines (28 loc) · 1005 Bytes
/
application-insights.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
locals {
appinsights_name = "${var.product}-${var.env}"
}
resource "azurerm_application_insights" "appinsights" {
name = local.appinsights_name
location = var.appinsights_location
resource_group_name = azurerm_resource_group.rg.name
application_type = var.appinsights_application_type
tags = local.common_tags
lifecycle {
ignore_changes = [
# Ignore changes to appinsights as otherwise upgrading to the Azure provider 2.x
# destroys and re-creates this appinsights instance
application_type,
]
}
}
output "appInsightsName" {
value = local.appinsights_name
}
output "appInsightsInstrumentationKey" {
value = azurerm_application_insights.appinsights.instrumentation_key
}
resource "azurerm_key_vault_secret" "AZURE_APPINSGHTS_KEY" {
name = "AppInsightsInstrumentationKey"
value = azurerm_application_insights.appinsights.instrumentation_key
key_vault_id = module.wa_key_vault.key_vault_id
}