Skip to content

Commit

Permalink
Add statuscake monitoring for preprod and prod
Browse files Browse the repository at this point in the history
  • Loading branch information
johnake committed Oct 17, 2023
1 parent cba4041 commit 3d6adbd
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 2 deletions.
29 changes: 29 additions & 0 deletions terraform/aks/statuscake.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
module "statuscake" {
for_each = var.statuscake_alerts

source = "./vendor/modules/aks//monitoring/statuscake"

uptime_urls = each.value.website_url
contact_groups = each.value.contact_group
}

resource "statuscake_ssl_check" "domain-alert" {
for_each = var.statuscake_alerts

check_interval = 3600 # Check once per hour
contact_groups = each.value.contact_group
follow_redirects = true

alert_config {
alert_at = [3, 7, 30] # Alert 1 month, 1 week then 3 days before expiration

on_reminder = true
on_expiry = true
on_broken = true
on_mixed = true
}

monitored_resource {
address = each.value.ssl_domain
}
}
8 changes: 8 additions & 0 deletions terraform/aks/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,11 @@ variable "review_url_redis_name" {
default = null
description = "the name of the secret storing review redis url"
}

# StatusCake variables
variable "statuscake_alerts" {
type = map(any)
default = {}
}

variable "api_token" { default = "" }
11 changes: 10 additions & 1 deletion terraform/aks/workspace_variables/preproduction_aks.tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,14 @@
"azure_resource_prefix": "s189t01",
"config_short": "pp",
"service_short": "faltrn",
"app_key_vault": "s189t01-faltrn-pp-app-kv"
"app_key_vault": "s189t01-faltrn-pp-app-kv",
"statuscake_alerts": {
"alert": {
"website_url": [
"https://preprod.find-a-lost-trn.education.gov.uk/health/all",
"https://find-a-lost-trn-preproduction.test.teacherservices.cloud/health/all"
],
"contact_group": [282783]
}
}
}
13 changes: 12 additions & 1 deletion terraform/aks/workspace_variables/production_aks.tfvars.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,16 @@
"config_short": "pd",
"service_short": "faltrn",
"app_key_vault": "s189p01-faltrn-pd-app-kv",
"worker_replicas": 0
"worker_replicas": 0,
"statuscake_alerts": {
"alert": {
"website_url": [
"https://find-a-lost-trn.education.gov.uk/health/all",
"https://find-a-lost-trn-production.teacherservices.cloud/health/all"
],
"contact_group": [282783],
"ssl_domain": "https://find-a-lost-trn.education.gov.uk",
"confirmations": 2
}
}
}

0 comments on commit 3d6adbd

Please sign in to comment.