From 0adb0bb0eb19d452083decc105cbaed2fa5fa6e7 Mon Sep 17 00:00:00 2001 From: Colin Saliceti Date: Thu, 5 Dec 2024 11:55:54 +0000 Subject: [PATCH 1/2] Suppress git clone warning --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 41a3ae0..5f833c3 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ terraform-init: composed-variables set-azure-account $(if ${DOCKER_IMAGE_TAG}, , $(eval DOCKER_IMAGE_TAG=main)) rm -rf terraform/application/vendor/modules/aks - git clone --depth=1 --single-branch --branch ${TERRAFORM_MODULES_TAG} https://github.com/DFE-Digital/terraform-modules.git terraform/application/vendor/modules/aks + git -c advice.detachedHead=false clone --depth=1 --single-branch --branch ${TERRAFORM_MODULES_TAG} https://github.com/DFE-Digital/terraform-modules.git terraform/application/vendor/modules/aks terraform -chdir=terraform/application init -upgrade -reconfigure \ -backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \ @@ -107,7 +107,7 @@ check-links: build domains-infra-init: domains composed-variables set-azure-account rm -rf terraform/domains/infrastructure/vendor/modules/domains - git clone --depth=1 --single-branch --branch ${TERRAFORM_MODULES_TAG} https://github.com/DFE-Digital/terraform-modules.git terraform/domains/infrastructure/vendor/modules/domains + git -c advice.detachedHead=false clone --depth=1 --single-branch --branch ${TERRAFORM_MODULES_TAG} https://github.com/DFE-Digital/terraform-modules.git terraform/domains/infrastructure/vendor/modules/domains terraform -chdir=terraform/domains/infrastructure init -reconfigure -upgrade \ -backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \ @@ -122,7 +122,7 @@ domains-infra-apply: domains composed-variables domains-infra-init domains-init: domains composed-variables set-azure-account rm -rf terraform/domains/environment_domains/vendor/modules/domains - git clone --depth=1 --single-branch --branch ${TERRAFORM_MODULES_TAG} https://github.com/DFE-Digital/terraform-modules.git terraform/domains/environment_domains/vendor/modules/domains + git -c advice.detachedHead=false clone --depth=1 --single-branch --branch ${TERRAFORM_MODULES_TAG} https://github.com/DFE-Digital/terraform-modules.git terraform/domains/environment_domains/vendor/modules/domains terraform -chdir=terraform/domains/environment_domains init -upgrade -reconfigure \ -backend-config=resource_group_name=${RESOURCE_GROUP_NAME} \ From 9a4457d756943f916b30164a50dec0c997d003bd Mon Sep 17 00:00:00 2001 From: Colin Saliceti Date: Thu, 5 Dec 2024 12:19:10 +0000 Subject: [PATCH 2/2] StatusCake monitoring Monitor uptime and SSL certificate validity in production --- terraform/application/.terraform.lock.hcl | 23 +++++++++++++++++++ .../application/config/production.tfvars.json | 5 +++- terraform/application/statuscake.tf | 10 ++++++++ terraform/application/terraform.tf | 8 ++++++- 4 files changed, 44 insertions(+), 2 deletions(-) create mode 100644 terraform/application/statuscake.tf diff --git a/terraform/application/.terraform.lock.hcl b/terraform/application/.terraform.lock.hcl index 6a2895a..34c61aa 100644 --- a/terraform/application/.terraform.lock.hcl +++ b/terraform/application/.terraform.lock.hcl @@ -65,3 +65,26 @@ provider "registry.terraform.io/hashicorp/kubernetes" { "zh:f569b65999264a9416862bca5cd2a6177d94ccb0424f3a4ef424428912b9cb3c", ] } + +provider "registry.terraform.io/statuscakedev/statuscake" { + version = "2.2.2" + constraints = "2.2.2" + hashes = [ + "h1:wFoZJfmNvG6XTf65NLai67geSHqYV1Tilx7OITrHilE=", + "zh:0916313344c579d6e05d70f88129a10fe48f7dabe0e61cad17874d6c496f288d", + "zh:0d491ff72c2eda6482855033ca2146c5ace1663d07cb3da7253b59ed2e2ec6f4", + "zh:11fffbce18eb3d3c283e877242f477e0c561342c19090240b60af7d948bd84ac", + "zh:1c3e89cf19118fc07d7b04257251fc9897e722c16e0a0df7b07fcd261f8c12e7", + "zh:1c6116092c59bc0010e147dc7832ae981d528f235cef563e5ae05a93ef8bac5c", + "zh:1f13a543b1d32cc1f1e3d2ed5ca83445f088787c335690fe20dee1203488a8bc", + "zh:23f55fd0714696c3863f892646a79a780cea1923c0c4d2b1064df735ba4156f5", + "zh:288fbb4431ac12014aa5aab10ee7166dfe71fd1158464e06e8a527aa4919e64e", + "zh:2a0746d3c8cdc7d0875df0f4605d81130e6da0ce6196d0f5f8661fe9191bc2ab", + "zh:31d660756abc53d252906fe1239fad58ecb6c1d0dbb087408a8af266be1f9ae4", + "zh:6765281d1b7efb41085c5375660b6c6b271babc5d09b2c030bec7176f7a7bfb6", + "zh:6d7204eadb667c1f2cab762a7a97234cf47452f0ecad680f5106c8fd02524c87", + "zh:b70a97b0eba471d683e23ce8744a5c67ef9952086e2d6f5825b72f32b6caff89", + "zh:df89ee4aaba88faea33d33384a36ea52588b5514644d335f724378a682d8d9da", + "zh:ffe2e1e7224ea5f4dd65b9eef45464e3124cfc824473b04e7af429f9177f2375", + ] +} diff --git a/terraform/application/config/production.tfvars.json b/terraform/application/config/production.tfvars.json index 2e31c4c..9628d96 100644 --- a/terraform/application/config/production.tfvars.json +++ b/terraform/application/config/production.tfvars.json @@ -1,5 +1,8 @@ { "cluster": "production", "namespace": "tech-arch-production", - "environment": "production" + "environment": "production", + "external_url": "https://technical-guidance.education.gov.uk/", + "enable_monitoring": true, + "statuscake_contact_groups": [282453] } diff --git a/terraform/application/statuscake.tf b/terraform/application/statuscake.tf new file mode 100644 index 0000000..9ec0591 --- /dev/null +++ b/terraform/application/statuscake.tf @@ -0,0 +1,10 @@ +module "statuscake" { + count = var.enable_monitoring ? 1 : 0 + + source = "./vendor/modules/aks//monitoring/statuscake" + + uptime_urls = compact([var.external_url]) + ssl_urls = compact([var.external_url]) + + contact_groups = var.statuscake_contact_groups +} diff --git a/terraform/application/terraform.tf b/terraform/application/terraform.tf index 9efd2bc..f82ed5a 100644 --- a/terraform/application/terraform.tf +++ b/terraform/application/terraform.tf @@ -9,7 +9,10 @@ terraform { source = "hashicorp/kubernetes" version = "2.24.0" } - + statuscake = { + source = "StatusCakeDev/statuscake" + version = "2.2.2" + } } backend "azurerm" { container_name = "terraform-state" @@ -37,5 +40,8 @@ provider "kubernetes" { args = module.cluster_data.kubelogin_args } } +} +provider "statuscake" { + api_token = module.infrastructure_secrets.map.STATUSCAKE-API-TOKEN }