From fc9c9aac15b905d0d2a1fb55b392b4d4ddc9bf43 Mon Sep 17 00:00:00 2001 From: Dominic Robinson <65237317+drobinson-moj@users.noreply.github.com> Date: Tue, 26 Nov 2024 10:40:25 +0000 Subject: [PATCH] TM-720: fix schedule alarms (#8800) * TM-720: fix for schedule-alarms * add output * fix --- .../hmpps-domain-services/locals_preproduction.tf | 1 - terraform/modules/baseline/outputs.tf | 15 +++++++++++++++ .../modules/baseline/schedule_alarms_lambda.tf | 2 +- terraform/modules/baseline/variables.tf | 5 ++--- 4 files changed, 18 insertions(+), 5 deletions(-) diff --git a/terraform/environments/hmpps-domain-services/locals_preproduction.tf b/terraform/environments/hmpps-domain-services/locals_preproduction.tf index 33544ecf6b1..8ba9fb7d04d 100644 --- a/terraform/environments/hmpps-domain-services/locals_preproduction.tf +++ b/terraform/environments/hmpps-domain-services/locals_preproduction.tf @@ -154,7 +154,6 @@ locals { } schedule_alarms_lambda = { - function_name = "schedule-alarms" alarm_patterns = [ "public-https-*-unhealthy-load-balancer-host", ] diff --git a/terraform/modules/baseline/outputs.tf b/terraform/modules/baseline/outputs.tf index 6c2d43ae440..2255c5325bf 100644 --- a/terraform/modules/baseline/outputs.tf +++ b/terraform/modules/baseline/outputs.tf @@ -146,11 +146,26 @@ output "security_groups" { value = aws_security_group.this } +output "schedule_alarms_lambda" { + description = "schedule alarms lambda output" + value = module.schedule_alarms_lambda +} + output "sns_topics" { description = "map of aws_sns_topic resources corresponding to var.sns_topics" value = aws_sns_topic.this } +output "ssm_associations" { + description = "map of aws_ssm_association resources corresponding to var.ssm_association" + value = aws_ssm_association.this +} + +output "ssm_documents" { + description = "map of aws_ssm_document resources corresponding to var.ssm_documents" + value = aws_ssm_document.this +} + output "ssm_parameters" { description = "map of security groups corresponding to var.ssm_parameters" value = merge( diff --git a/terraform/modules/baseline/schedule_alarms_lambda.tf b/terraform/modules/baseline/schedule_alarms_lambda.tf index 7a195694a5b..e0e788d1956 100644 --- a/terraform/modules/baseline/schedule_alarms_lambda.tf +++ b/terraform/modules/baseline/schedule_alarms_lambda.tf @@ -6,7 +6,7 @@ module "schedule_alarms_lambda" { length(var.schedule_alarms_lambda.alarm_patterns) > 0 ) ? 1 : 0 - lambda_function_name = var.schedule_alarms_lambda.function_name + lambda_function_name = "schedule-alarms" lambda_log_level = var.schedule_alarms_lambda.lambda_log_level alarm_list = var.schedule_alarms_lambda.alarm_list diff --git a/terraform/modules/baseline/variables.tf b/terraform/modules/baseline/variables.tf index e50df55f260..9f643ada384 100644 --- a/terraform/modules/baseline/variables.tf +++ b/terraform/modules/baseline/variables.tf @@ -918,13 +918,12 @@ variable "s3_buckets" { variable "schedule_alarms_lambda" { description = "" type = object({ - function_name = optional(string, null) lambda_log_level = optional(string, "INFO") alarm_list = optional(list(string), []) alarm_patterns = optional(list(string), []) disable_weekend = optional(bool, true) - start_time = optional(string, "06:15") - end_time = optional(string, "20:45") + start_time = optional(string, "20:45") # when to disable alarm + end_time = optional(string, "06:15") # when to re-enable alarm tags = optional(map(string), {}) }) default = {}