File tree Expand file tree Collapse file tree 4 files changed +34
-3
lines changed
infrastructure/modules/application-insights-availability-test Expand file tree Collapse file tree 4 files changed +34
-3
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,15 @@ See also the following ADO template step that can be used to verify endpoint hea
1212For the list of inputs, outputs, resources... check the [ terraform module documentation] ( tfdocs.md ) .
1313
1414## Usage
15- Create the application Insights availability test:
15+ Create the application insights availability test:
1616``` hcl
1717module "azurerm_application_insights_standard_web_test" {
1818 source = "../dtos-devops-templates/infrastructure/modules/application-insights-availability-test"
1919
2020 name = "${var.app_short_name}-web-${var.environment}"
2121 resource_group_name = var.resource_group_name_infra
22- application_insights_id = data.azurerm_log_analytics_workspace.audit[0].id
23- target_url = "${module.container-apps[0].external_url}healthcheck/"
22+ action_group_id = module.monitor_action_group.id
23+ application_insights_id = module.log_analytics_workspace_audit.id
24+ target_url = "${module.container-apps[0].external_url}healthcheck"
2425}
2526```
Original file line number Diff line number Diff line change @@ -14,3 +14,21 @@ resource "azurerm_application_insights_standard_web_test" "this" {
1414
1515 geo_locations = var. geo_locations
1616}
17+
18+ resource "azurerm_monitor_metric_alert" "this" {
19+ name = " ${ var . name } -availability-alert"
20+ resource_group_name = var. resource_group_name
21+ scopes = [azurerm_application_insights_standard_web_test . this . id , var . application_insights_id ]
22+ description = " availability test alert"
23+ severity = 0
24+
25+ application_insights_web_test_location_availability_criteria {
26+ web_test_id = azurerm_application_insights_standard_web_test. this . id
27+ component_id = var. application_insights_id
28+ failed_location_count = 2
29+ }
30+
31+ action {
32+ action_group_id = var. action_group_id
33+ }
34+ }
Original file line number Diff line number Diff line change 44
55The following input variables are required:
66
7+ ### <a name =" input_action_group_id " ></a > [ action\_ group\_ id] ( #input\_ action\_ group\_ id )
8+
9+ Description: ID of the action group to notify.
10+
11+ Type: ` string `
12+
713### <a name =" input_application_insights_id " ></a > [ application\_ insights\_ id] ( #input\_ application\_ insights\_ id )
814
915Description: The Application Insights resource id to associate the availability test with
@@ -78,3 +84,4 @@ Default: `30`
7884The following resources are used by this module:
7985
8086- [ azurerm_application_insights_standard_web_test.this] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/application_insights_standard_web_test ) (resource)
87+ - [ azurerm_monitor_metric_alert.this] ( https://registry.terraform.io/providers/hashicorp/azurerm/latest/docs/resources/monitor_metric_alert ) (resource)
Original file line number Diff line number Diff line change @@ -23,6 +23,11 @@ variable "application_insights_id" {
2323 description = " The Application Insights resource id to associate the availability test with"
2424}
2525
26+ variable "action_group_id" {
27+ type = string
28+ description = " ID of the action group to notify."
29+ }
30+
2631variable "frequency" {
2732 type = number
2833 default = 300
You can’t perform that action at this time.
0 commit comments