Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DOP-1956] StatusCake integration #243

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions azure/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,17 @@ terraform {
source = "hashicorp/vault"
version = "3.13.0"
}
statuscake = {
source = "StatusCakeDev/statuscake"
version = "2.2.2"
}
}
}

provider "statuscake" {
api_token = var.statuscake_api_key
}

provider "azurerm" {
features {
cognitive_account {
Expand Down
2 changes: 1 addition & 1 deletion azure/tf-smoketest-variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ resource "kubernetes_config_map" "terraform-variables" {
thanos_enabled = "${jsonencode(var.thanos_enabled)}"
harness_delegate = "${jsonencode(var.harness_delegate)}"
harness_mount_path = "${jsonencode(var.harness_mount_path)}"
statuscake_enabled = "${jsonencode(var.statuscake_enabled)}"
terraform_smoketests_enabled = "${jsonencode(var.terraform_smoketests_enabled)}"
resource_group_name = "${jsonencode(var.resource_group_name)}"
create_resource_group = "${jsonencode(var.create_resource_group)}"
Expand All @@ -111,7 +112,6 @@ resource "kubernetes_config_map" "terraform-variables" {
sentinel_workspace_name = "${jsonencode(var.sentinel_workspace_name)}"
sentinel_workspace_resource_group_name = "${jsonencode(var.sentinel_workspace_resource_group_name)}"
sentinel_workspace_id = "${jsonencode(var.sentinel_workspace_id)}"

}
}

2 changes: 2 additions & 0 deletions azure/user_vars.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,5 @@ additional_node_pools = {
cluster_auto_scaling_max_count = 1
}
}

statuscake_enabled = strcontains(lower(var.account), "indico-") ? true : false
16 changes: 11 additions & 5 deletions azure/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,11 @@ variable "harness_mount_path" {
default = "harness"
}

variable "statuscake_enabled" {
type = bool
default = false
}

variable "terraform_smoketests_enabled" {
type = bool
default = true
Expand All @@ -669,14 +674,19 @@ variable "use_static_ssl_certificates" {
default = false
}

variable "statuscake_api_key" {
type = string
sensitive = true
default = ""
}

variable "ssl_static_secret_name" {
type = string
default = "indico-ssl-static-cert"
description = "secret_name for static ssl certificate"
}

# Log analytics

variable "sentinel_workspace_name" {
type = string
default = null # "${var.account}-sentinel-workspace"
Expand All @@ -691,7 +701,3 @@ variable "sentinel_workspace_id" {
type = string
default = null
}




10 changes: 10 additions & 0 deletions ipa.tf
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,16 @@ module "secrets-operator-setup" {
}


module "statuscake-monitoring" {
depends_on = [
module.cluster
]
count = var.argo_enabled == true && var.statuscake_enabled == true ? 1 : 0
Eric-Fontana-Indico marked this conversation as resolved.
Show resolved Hide resolved
source = "./modules/common/statuscake"
app_edge_url = "https://${local.dns_name}"
cluster_name = lower("${var.aws_account}-${var.region}-${var.label}")
}

resource "helm_release" "ipa-vso" {
count = var.thanos_enabled == true ? 1 : 0
depends_on = [
Expand Down
8 changes: 8 additions & 0 deletions main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,21 @@ terraform {
source = "loafoe/htpasswd"
version = "1.0.4"
}
statuscake = {
source = "StatusCakeDev/statuscake"
version = "2.2.2"
}
azurerm = {
source = "hashicorp/azurerm"
version = "3.95.0"
}
}
}

provider "statuscake" {
api_token = var.statuscake_api_key
}

provider "time" {}

provider "keycloak" {
Expand Down
8 changes: 8 additions & 0 deletions modules/common/statuscake/providers.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
terraform {
required_providers {
statuscake = {
source = "StatusCakeDev/statuscake"
version = "2.2.2"
}
}
}
59 changes: 59 additions & 0 deletions modules/common/statuscake/statuscake.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
resource "statuscake_ssl_check" "app-edge" {
check_interval = 3600 # every 6 hours
user_agent = "terraform managed SSL check"
follow_redirects = true

alert_config {
alert_at = [29, 7, 1]
on_broken = false
on_expiry = true
on_mixed = false
on_reminder = true
}

contact_groups = [
var.statuscake_devops_sa_contact_group_id
]

monitored_resource {
address = var.app_edge_url
}
}

resource "statuscake_uptime_check" "app-edge" {
check_interval = 60
confirmation = 3
name = var.cluster_name
trigger_rate = 10

contact_groups = [
var.statuscake_devops_sa_contact_group_id
]


http_check {
enable_cookies = true
follow_redirects = true
timeout = 20
user_agent = "terraform managed uptime check"
validate_ssl = true

status_codes = [
"204", "205", "206", "303", "400", "401", "403", "404",
"405", "406", "408", "410", "413", "444", "429", "494",
"495", "497", "499", "500", "501", "502", "503", "504",
"505", "506", "507", "508", "509", "510", "511", "521",
"522", "523", "524", "520", "598", "599"
]
}



monitored_resource {
address = var.app_edge_url
}

tags = [
"tf_cod"
]
}
16 changes: 16 additions & 0 deletions modules/common/statuscake/variables.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
variable "statuscake_contact_group_name" {
type = string
default = "devops-sa"
}

variable "statuscake_devops_sa_contact_group_id" {
default = "307898" # group for devops-sa
}

variable "cluster_name" {
type = string
}

variable "app_edge_url" {
type = string
}
1 change: 1 addition & 0 deletions tf-smoketest-variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ resource "kubernetes_config_map" "terraform-variables" {
harness_delegate = "${jsonencode(var.harness_delegate)}"
harness_delegate_replicas = "${jsonencode(var.harness_delegate_replicas)}"
harness_mount_path = "${jsonencode(var.harness_mount_path)}"
statuscake_enabled = "${jsonencode(var.statuscake_enabled)}"
enable_s3_backup = "${jsonencode(var.enable_s3_backup)}"

}
Expand Down
5 changes: 5 additions & 0 deletions user_vars.auto.tfvars
Original file line number Diff line number Diff line change
Expand Up @@ -107,3 +107,8 @@ include_fsx = false
include_efs = true
#cluster
az_count = 2

statuscake_enabled = strcontains(lower(var.aws_account), "indico-") ? true : false



11 changes: 11 additions & 0 deletions variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -834,6 +834,17 @@ variable "harness_mount_path" {
default = "harness"
}

variable "statuscake_enabled" {
type = bool
default = false
}

variable "statuscake_api_key" {
type = string
sensitive = true
default = ""
}

variable "enable_s3_backup" {
type = bool
default = true
Expand Down