Skip to content

Commit

Permalink
fix: fetch application insights info only when required
Browse files Browse the repository at this point in the history
  • Loading branch information
assafgi committed Dec 2, 2024
1 parent 9549981 commit c12ff44
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions functions.tf
Original file line number Diff line number Diff line change
Expand Up @@ -215,13 +215,14 @@ data "azurerm_application_insights" "application_insights" {
}

data "azurerm_resource_group" "application_insights_rg" {
name = local.application_insights_rg_name
count = var.application_insights_name == "" && var.enable_application_insights ? 1 : 0
name = local.application_insights_rg_name
}

resource "azurerm_application_insights" "application_insights" {
count = var.application_insights_name == "" && var.enable_application_insights ? 1 : 0
name = "${var.prefix}-${var.cluster_name}-application-insights"
location = data.azurerm_resource_group.application_insights_rg.location
location = data.azurerm_resource_group.application_insights_rg[0].location
resource_group_name = local.application_insights_rg_name
workspace_id = local.log_analytics_workspace_id
application_type = "web"
Expand Down

0 comments on commit c12ff44

Please sign in to comment.