Skip to content

Commit

Permalink
DTSPO-15909 - migrated Application Insights
Browse files Browse the repository at this point in the history
  • Loading branch information
cpareek committed Jan 4, 2024
1 parent 4d2dd30 commit 9e44d9d
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions app-insights.tf
Original file line number Diff line number Diff line change
@@ -1,27 +1,28 @@
resource "azurerm_application_insights" "appinsights" {
name = "${var.product}-${var.env}"
location = azurerm_resource_group.opal_resource_group.location
resource_group_name = azurerm_resource_group.opal_resource_group.name
application_type = "web"
tags = var.common_tags
module "application_insights" {
source = "git@github.com:hmcts/terraform-module-application-insights?ref=main"

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,
]
}
env = var.env
product = var.product


resource_group_name = azurerm_resource_group.rg.name

common_tags = var.common_tags
}

moved {
from = azurerm_application_insights.appinsights
to = module.application_insights.azurerm_application_insights.this
}

resource "azurerm_key_vault_secret" "app_insights_connection_string" {
name = "app-insights-connection-string"
value = azurerm_application_insights.appinsights.connection_string
value = module.application_insights.connection_string
key_vault_id = module.opal_key_vault.key_vault_id
}

resource "azurerm_key_vault_secret" "azure_appinsights_key" {
name = "AppInsightsInstrumentationKey"
value = azurerm_application_insights.appinsights.instrumentation_key
value = module.application_insights.instrumentation_key
key_vault_id = module.opal_key_vault.key_vault_id
}

0 comments on commit 9e44d9d

Please sign in to comment.