Skip to content

Commit 6034422

Browse files
Update opentelemetry-agents.md
Added Terraform example for Application Insights
1 parent b09993d commit 6034422

File tree

1 file changed

+33
-1
lines changed

1 file changed

+33
-1
lines changed

articles/container-apps/opentelemetry-agents.md

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ The following table shows you what type of data you can send to each destination
5454

5555
## Azure Monitor Application Insights
5656

57-
The only configuration detail required from Application Insights is the connection string. Once you have the connection string, you can configure the agent via your container app's ARM template or with Azure CLI commands.
57+
The only configuration detail required from Application Insights is the connection string. Once you have the connection string, you can configure the agent via your container app's ARM template, with Azure CLI commands or Terraform.
5858

5959
# [ARM template](#tab/arm)
6060

@@ -91,6 +91,38 @@ az containerapp env telemetry app-insights set \
9191
--enable-open-telemetry-logs true
9292
```
9393

94+
# [Terraform](#tab/terraform)
95+
96+
```hcl
97+
resource "azapi_update_resource" "app_insights_open_telemetry_integration" {
98+
name = azurerm_container_app_environment.managed_environment.name
99+
parent_id = azurerm_resource_group.resource_group.id
100+
type = "Microsoft.App/managedEnvironments@2023-11-02-preview"
101+
body = jsonencode({
102+
properties = {
103+
appInsightsConfiguration = {
104+
connectionString = azurerm_application_insights.applicationinsights.connection_string
105+
}
106+
appLogsConfiguration = {
107+
destination = "log-analytics"
108+
logAnalyticsConfiguration = {
109+
customerId = azurerm_log_analytics_workspace.workspace.workspace_id
110+
sharedKey = azurerm_log_analytics_workspace.workspace.primary_shared_key
111+
}
112+
}
113+
openTelemetryConfiguration = {
114+
tracesConfiguration = {
115+
destinations = ["appInsights"]
116+
}
117+
logsConfiguration = {
118+
destinations = ["appInsights"]
119+
}
120+
}
121+
}
122+
})
123+
}
124+
```
125+
94126
---
95127

96128
## Datadog

0 commit comments

Comments
 (0)