Skip to content

Commit 8fdb896

Browse files
committed
Create application insights
1 parent 3a0238d commit 8fdb896

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

terraform/main.tf

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,21 @@ resource "azurerm_log_analytics_workspace" "law" {
2020
retention_in_days = 30
2121
}
2222

23+
resource "azurerm_application_insights" "ai" {
24+
name = var.ai_name
25+
location = data.azurerm_resource_group.rg.location
26+
resource_group_name = data.azurerm_resource_group.rg.name
27+
application_type = "web"
28+
workspace_id = azurerm_log_analytics_workspace.law.id
29+
retention_in_days = 30
30+
}
31+
32+
resource "azurerm_key_vault_secret" "ai_connection_string" {
33+
name = "ApplicationInsightsConnectionString"
34+
value = azurerm_application_insights.ai.connection_string
35+
key_vault_id = azurerm_key_vault.kv.id
36+
}
37+
2338
resource "azurerm_container_app_environment" "ca_env" {
2439
name = var.ca_env_name
2540
location = data.azurerm_resource_group.rg.location

terraform/variables.tf

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ variable "kv_name" {
1616
type = string
1717
}
1818

19+
variable "ai_name" {
20+
type = string
21+
}
22+
1923
variable "law_name" {
2024
type = string
2125
}

0 commit comments

Comments
 (0)