File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ locals {
2+ avail = var. availability_test
3+ }
4+
5+ module "azurerm_application_insights_standard_availability_test" {
6+ for_each = { for key , val in var . regions : key => val if val . is_primary_region && var . features . alerts_enabled && local . avail != null }
7+
8+ source = " ../../../dtos-devops-templates/infrastructure/modules/application-insights-availability-test"
9+ name = " ${ module . regions_config [each . key ]. names . function-app } -${ var . availability_test . name_suffix } "
10+ resource_group_name = data. azurerm_application_insights . ai . resource_group_name
11+ location = each. key
12+ action_group_id = var. features . alerts_enabled ? module. monitor_action_group_performance [0 ]. monitor_action_group . id : null
13+ application_insights_id = data. azurerm_application_insights . ai . id
14+
15+ target_url = var. availability_test . target_url
16+
17+ timeout = var. availability_test . timeout
18+ frequency = var. availability_test . frequency
19+
20+ headers = {
21+ OCP-Apim-Subscription-Key = var.OCP_APIM_SUBSCRIPTION_KEY
22+ }
23+
24+ ssl_validation = {
25+ expected_status_code = var.availability_test.ssl_validation.expected_status_code
26+ ssl_cert_remaining_lifetime = var.availability_test.ssl_validation.ssl_cert_remaining_lifetime
27+ }
28+
29+ alert = var. availability_test . alert
30+ }
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ tags = {
2020 Environment = " development"
2121}
2222
23+ availability_test = {
24+ name_suffix = " retrieve-cohort-request-audit-webtest"
25+ target_url = " https://api.non-live.nationalscreening.nhs.uk/dev-uks-retrieve-cohort-request-audit/health"
26+ }
27+
2328regions = {
2429 uksouth = {
2530 is_primary_region = true
Original file line number Diff line number Diff line change @@ -20,6 +20,11 @@ tags = {
2020 Environment = " production"
2121}
2222
23+ availability_test = {
24+ name_suffix = " retrieve-cohort-request-audit-webtest"
25+ target_url = " https://api.nationalscreening.nhs.uk/prod-uks-retrieve-cohort-request-audit/health"
26+ }
27+
2328regions = {
2429 uksouth = {
2530 is_primary_region = true
Original file line number Diff line number Diff line change @@ -19,6 +19,11 @@ tags = {
1919 Environment = " sandbox"
2020}
2121
22+ availability_test = {
23+ name_suffix = " retrieve-cohort-request-audit-webtest"
24+ target_url = " https://api.non-live.nationalscreening.nhs.uk/dev-uks-retrieve-cohort-request-audit/health"
25+ }
26+
2227regions = {
2328 uksouth = {
2429 is_primary_region = true
@@ -667,7 +672,7 @@ function_apps = {
667672 }
668673 ]
669674 env_vars_static = {
670- AcceptableLatencyThresholdMs = " 500"
675+ AcceptableLatencyThresholdMs = " 500"
671676 RetrieveSupersededRecordsLast = " true"
672677 }
673678 }
@@ -864,7 +869,7 @@ function_apps = {
864869 ]
865870 env_vars_static = {
866871 AcceptableLatencyThresholdMs = " 500"
867- MaxRetryCount= 3
872+ MaxRetryCount = 3
868873 }
869874 }
870875
Original file line number Diff line number Diff line change @@ -58,6 +58,13 @@ variable "TARGET_SUBSCRIPTION_ID" {
5858 type = string
5959}
6060
61+ variable "OCP_APIM_SUBSCRIPTION_KEY" {
62+ description = " API Management subscription key"
63+ type = string
64+ sensitive = true
65+ default = null
66+ }
67+
6168variable "application" {
6269 description = " Project/Application code for deployment"
6370 type = string
@@ -93,6 +100,32 @@ variable "features" {
93100 type = map (bool )
94101}
95102
103+ variable "availability_test" {
104+ description = " Configuration for the Application Insights Standard Web Test"
105+ type = object ({
106+ name_suffix = string
107+ target_url = string
108+
109+ frequency = optional (number , 900 )
110+ timeout = optional (number , 30 )
111+
112+ ssl_validation = optional (object ({
113+ enabled = optional (bool , true )
114+ expected_status_code = optional (number , 200 )
115+ ssl_cert_remaining_lifetime = optional (number , 30 )
116+ }), {})
117+
118+ alert = optional (object ({
119+ description = optional (string , " Endpoint Availability & Certificate Expiry Monitoring" )
120+ frequency = optional (string , " PT1H" )
121+ window_size = optional (string , " P1D" )
122+ auto_mitigate = optional (bool , false )
123+ }), {})
124+ })
125+
126+ default = null
127+ }
128+
96129variable "regions" {
97130 type = map (object ({
98131 address_space = optional (string )
You can’t perform that action at this time.
0 commit comments