Skip to content

Commit e553437

Browse files
authored
feat(apim): add diagnostics settings (#1423)
* add diagnostics settings * fix diagnostics * terraform fmt --------- Co-authored-by: tjololo <[email protected]>
1 parent 04e272e commit e553437

File tree

2 files changed

+88
-1
lines changed

2 files changed

+88
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
resource "azurerm_application_insights" "appinsights" {
2+
name = "${var.name_prefix}-appinsights"
3+
resource_group_name = azurerm_resource_group.rg.name
4+
location = azurerm_resource_group.rg.location
5+
application_type = "web"
6+
}
7+
8+
resource "azurerm_api_management_logger" "apimlogger" {
9+
name = "${var.name_prefix}-apimlogger"
10+
api_management_name = azurerm_api_management.admin_test_apim.name
11+
resource_group_name = azurerm_resource_group.rg.name
12+
13+
application_insights {
14+
instrumentation_key = azurerm_application_insights.appinsights.instrumentation_key
15+
}
16+
}
17+
18+
resource "azurerm_api_management_diagnostic" "application_insights" {
19+
identifier = "applicationinsights"
20+
resource_group_name = azurerm_resource_group.rg.name
21+
api_management_name = azurerm_api_management.admin_test_apim.name
22+
api_management_logger_id = azurerm_api_management_logger.apimlogger.id
23+
24+
sampling_percentage = 0.0
25+
always_log_errors = true
26+
log_client_ip = true
27+
verbosity = "information"
28+
http_correlation_protocol = "W3C"
29+
30+
frontend_request {
31+
body_bytes = 32
32+
headers_to_log = [
33+
"content-type",
34+
"accept",
35+
"origin",
36+
]
37+
}
38+
39+
frontend_response {
40+
body_bytes = 32
41+
headers_to_log = [
42+
"content-type",
43+
"content-length",
44+
"origin",
45+
]
46+
}
47+
48+
backend_request {
49+
body_bytes = 32
50+
headers_to_log = [
51+
"content-type",
52+
"accept",
53+
"origin",
54+
]
55+
}
56+
57+
backend_response {
58+
body_bytes = 32
59+
headers_to_log = [
60+
"content-type",
61+
"content-length",
62+
"origin",
63+
]
64+
}
65+
}
66+
67+
68+
resource "azurerm_api_management_diagnostic" "azuremonitor" {
69+
identifier = "azuremonitor"
70+
resource_group_name = azurerm_resource_group.rg.name
71+
api_management_name = azurerm_api_management.admin_test_apim.name
72+
api_management_logger_id = azurerm_api_management_logger.apimlogger.id
73+
74+
sampling_percentage = 0.0
75+
always_log_errors = true
76+
log_client_ip = true
77+
verbosity = "information"
78+
http_correlation_protocol = "W3C"
79+
80+
frontend_request {}
81+
82+
frontend_response {}
83+
84+
backend_request {}
85+
86+
backend_response {}
87+
}

infrastructure/adminservices-test/altinn-apim-test-rg/apim.tf

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ resource "azurerm_api_management" "admin_test_apim" {
66
publisher_email = "[email protected]"
77

88
sku_name = "Developer_1"
9-
}
9+
}

0 commit comments

Comments
 (0)