Skip to content

Commit

Permalink
Merge pull request #820 from hmcts/DTSPO-15909-app-insights
Browse files Browse the repository at this point in the history
DTSPO-15909 - migrated Application Insights
  • Loading branch information
cpareek authored Dec 14, 2023
2 parents 63c0de9 + 5aaf2d8 commit b202ce9
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
27 changes: 14 additions & 13 deletions infrastructure/main.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
locals {
app_full_name = "xui-${var.component}"
ase_name = "core-compute-${var.env}"
local_env = (var.env == "preview" || var.env == "spreview") ? (var.env == "preview" ) ? "aat" : "saat" : var.env
local_env = (var.env == "preview" || var.env == "spreview") ? (var.env == "preview") ? "aat" : "saat" : var.env
shared_vault_name = "${var.shared_product_name}-${local.local_env}"
}

Expand Down Expand Up @@ -36,23 +36,24 @@ module "redis6-cache" {
public_network_access_enabled = false
}

resource "azurerm_application_insights" "appinsights" {
name = "${local.app_full_name}-appinsights-${var.env}"
location = var.location
module "application_insights" {
source = "[email protected]:hmcts/terraform-module-application-insights?ref=main"

env = var.env
product = var.product
name = "${local.app_full_name}-appinsights"

resource_group_name = azurerm_resource_group.rg.name
application_type = var.application_type

tags = var.common_tags
common_tags = var.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,
]
}
moved {
from = azurerm_application_insights.appinsights
to = module.application_insights.azurerm_application_insights.this
}


resource "azurerm_resource_group" "rg" {
name = "${local.app_full_name}-${var.env}"
location = var.location
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/output.tf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ output "microserviceName" {
}

output "appInsightsInstrumentationKey" {
value = azurerm_application_insights.appinsights.instrumentation_key
value = module.application_insights.instrumentation_key
sensitive = true
}

0 comments on commit b202ce9

Please sign in to comment.