Skip to content

Commit

Permalink
Merge branch 'main' into jitbit-revert-address-change
Browse files Browse the repository at this point in the history
  • Loading branch information
georgepstaylor committed Jun 4, 2024
2 parents 64ac36a + 3968e97 commit 701cad7
Show file tree
Hide file tree
Showing 7 changed files with 496 additions and 336 deletions.
44 changes: 22 additions & 22 deletions terraform/environments/contract-work-administration/cloudwatch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ resource "aws_cloudwatch_metric_alarm" "efs_data_write" {
period = "60"
statistic = "Average"
threshold = local.application_data.accounts[local.environment].efs_data_write_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
treat_missing_data = "ignore"
tags = merge(
local.tags,
Expand All @@ -37,8 +37,8 @@ resource "aws_cloudwatch_metric_alarm" "efs_data_read" {
period = "60"
statistic = "Average"
threshold = local.application_data.accounts[local.environment].efs_data_read_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
treat_missing_data = "ignore"
tags = merge(
local.tags,
Expand All @@ -62,8 +62,8 @@ resource "aws_cloudwatch_metric_alarm" "database_cpu" {
period = "60"
statistic = "Average"
threshold = local.application_data.accounts[local.environment].database_cpu_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
# treat_missing_data = "ignore"
tags = merge(
local.tags,
Expand All @@ -87,8 +87,8 @@ resource "aws_cloudwatch_metric_alarm" "elb_target_response_time" {
period = 60
statistic = "Average"
threshold = local.application_data.accounts[local.environment].elb_target_response_time_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
# treat_missing_data = ""
tags = merge(
local.tags,
Expand All @@ -112,8 +112,8 @@ resource "aws_cloudwatch_metric_alarm" "elb_request_count" {
period = "60"
statistic = "Sum"
threshold = local.application_data.accounts[local.environment].elb_request_count_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
# treat_missing_data = ""
tags = merge(
local.tags,
Expand All @@ -137,8 +137,8 @@ resource "aws_cloudwatch_metric_alarm" "app1_ec2_status_check" {
period = "60"
statistic = "Sum"
threshold = local.application_data.accounts[local.environment].status_check_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
# treat_missing_data = ""
tags = merge(
local.tags,
Expand All @@ -162,8 +162,8 @@ resource "aws_cloudwatch_metric_alarm" "app2_ec2_status_check" {
period = "60"
statistic = "Sum"
threshold = local.application_data.accounts[local.environment].status_check_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
# treat_missing_data = ""
tags = merge(
local.tags,
Expand All @@ -187,8 +187,8 @@ resource "aws_cloudwatch_metric_alarm" "cm_ec2_status_check" {
period = "60"
statistic = "Sum"
threshold = local.application_data.accounts[local.environment].status_check_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
# treat_missing_data = ""
tags = merge(
local.tags,
Expand All @@ -212,8 +212,8 @@ resource "aws_cloudwatch_metric_alarm" "database_ec2_status_check" {
period = "60"
statistic = "Sum"
threshold = local.application_data.accounts[local.environment].status_check_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
# treat_missing_data = ""
tags = merge(
local.tags,
Expand All @@ -237,8 +237,8 @@ resource "aws_cloudwatch_metric_alarm" "database_ec2_swap" {
period = "60"
statistic = "Average"
threshold = local.application_data.accounts[local.environment].database_ec2_swap_alarm_threshold
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
# treat_missing_data = ""
tags = merge(
local.tags,
Expand All @@ -262,8 +262,8 @@ resource "aws_cloudwatch_metric_alarm" "database_ec2_swap" {
# period = ""
# statistic = ""
# threshold = ""
# # alarm_actions = [aws_sns_topic.alerting_topic.arn]
# # ok_actions = [aws_sns_topic.alerting_topic.arn]
# alarm_actions = [aws_sns_topic.cwa.arn]
# ok_actions = [aws_sns_topic.cwa.arn]
# treat_missing_data = ""
# tags = merge(
# local.tags,
Expand Down
4 changes: 2 additions & 2 deletions terraform/environments/contract-work-administration/efs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ resource "aws_cloudwatch_metric_alarm" "efs_connection_repo_home" {
period = "60"
statistic = "Sum"
threshold = local.environment == "production" ? 4 : 3
# alarm_actions = [aws_sns_topic.alerting_topic.arn]
# ok_actions = [aws_sns_topic.alerting_topic.arn]
alarm_actions = [aws_sns_topic.cwa.arn]
ok_actions = [aws_sns_topic.cwa.arn]
treat_missing_data = "breaching"
tags = merge(
local.tags,
Expand Down
41 changes: 41 additions & 0 deletions terraform/environments/contract-work-administration/sns.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
locals {
pagerduty_integration_key_name = local.environment == "production" ? "laa_cwa_prod_alarms" : "laa_cwa_nonprod_alarms"
}

# SNS topic for monitoring to send alarms to
resource "aws_sns_topic" "cwa" {
name = "${local.application_name_short}-${local.environment}-alerting-topic"
tags = merge(
local.tags,
{
Name = "${local.application_name_short}-${local.environment}-alerting-topic"
}
)
}

# Pager duty integration

# Get the map of pagerduty integration keys from the modernisation platform account
data "aws_secretsmanager_secret" "pagerduty_integration_keys" {
provider = aws.modernisation-platform
name = "pagerduty_integration_keys"
}
data "aws_secretsmanager_secret_version" "pagerduty_integration_keys" {
provider = aws.modernisation-platform
secret_id = data.aws_secretsmanager_secret.pagerduty_integration_keys.id
}

# Add a local to get the keys
locals {
pagerduty_integration_keys = jsondecode(data.aws_secretsmanager_secret_version.pagerduty_integration_keys.secret_string)
}

# link the sns topic to the service
module "pagerduty_core_alerts" {
depends_on = [
aws_sns_topic.cwa
]
source = "github.com/ministryofjustice/modernisation-platform-terraform-pagerduty-integration?ref=v2.0.0"
sns_topics = [aws_sns_topic.cwa.name]
pagerduty_integration_key = local.pagerduty_integration_keys[local.pagerduty_integration_key_name]
}
26 changes: 13 additions & 13 deletions terraform/environments/tribunals/asg-shared.tf
Original file line number Diff line number Diff line change
Expand Up @@ -222,25 +222,25 @@ resource "aws_security_group" "cluster_ec2" {
protocol = "-1"
security_groups = [
module.appeals.tribunals_lb_sc_id,
module.ahmlr.tribunals_lb_sc_id
# module.care_standards.tribunals_lb_sc_id,
# module.cicap.tribunals_lb_sc_id,
module.ahmlr.tribunals_lb_sc_id,
module.care_standards.tribunals_lb_sc_id,
module.cicap.tribunals_lb_sc_id,
# module.employment_appeals.tribunals_lb_sc_id,
# module.finance_and_tax.tribunals_lb_sc_id,
# module.immigration_services.tribunals_lb_sc_id,
# module.information_tribunal.tribunals_lb_sc_id,
# module.lands_tribunal.tribunals_lb_sc_id,
# module.transport.tribunals_lb_sc_id,
# module.charity_tribunal_decisions.tribunals_lb_sc_id, module.charity_tribunal_decisions.tribunals_lb_sc_id_sftp,
# module.claims_management_decisions.tribunals_lb_sc_id, module.claims_management_decisions.tribunals_lb_sc_id_sftp,
# module.consumer_credit_appeals.tribunals_lb_sc_id, module.consumer_credit_appeals.tribunals_lb_sc_id_sftp,
# module.estate_agent_appeals.tribunals_lb_sc_id, module.estate_agent_appeals.tribunals_lb_sc_id_sftp,
# module.primary_health_lists.tribunals_lb_sc_id, module.primary_health_lists.tribunals_lb_sc_id_sftp,
# module.siac.tribunals_lb_sc_id, module.siac.tribunals_lb_sc_id_sftp,
# module.sscs_venue_pages.tribunals_lb_sc_id, module.sscs_venue_pages.tribunals_lb_sc_id_sftp,
# module.tax_chancery_decisions.tribunals_lb_sc_id, module.tax_chancery_decisions.tribunals_lb_sc_id_sftp,
# module.tax_tribunal_decisions.tribunals_lb_sc_id, module.tax_tribunal_decisions.tribunals_lb_sc_id_sftp,
# module.ftp-admin-appeals.tribunals_lb_sc_id, module.ftp-admin-appeals.tribunals_lb_sc_id_sftp
module.charity_tribunal_decisions.tribunals_lb_sc_id, module.charity_tribunal_decisions.tribunals_lb_sc_id_sftp,
module.claims_management_decisions.tribunals_lb_sc_id, module.claims_management_decisions.tribunals_lb_sc_id_sftp,
module.consumer_credit_appeals.tribunals_lb_sc_id, module.consumer_credit_appeals.tribunals_lb_sc_id_sftp,
module.estate_agent_appeals.tribunals_lb_sc_id, module.estate_agent_appeals.tribunals_lb_sc_id_sftp,
module.primary_health_lists.tribunals_lb_sc_id, module.primary_health_lists.tribunals_lb_sc_id_sftp,
module.siac.tribunals_lb_sc_id, module.siac.tribunals_lb_sc_id_sftp,
module.sscs_venue_pages.tribunals_lb_sc_id, module.sscs_venue_pages.tribunals_lb_sc_id_sftp,
module.tax_chancery_decisions.tribunals_lb_sc_id, module.tax_chancery_decisions.tribunals_lb_sc_id_sftp,
module.tax_tribunal_decisions.tribunals_lb_sc_id, module.tax_tribunal_decisions.tribunals_lb_sc_id_sftp,
module.ftp_admin_appeals.tribunals_lb_sc_id, module.ftp_admin_appeals.tribunals_lb_sc_id_sftp
]
}

Expand Down
101 changes: 101 additions & 0 deletions terraform/environments/tribunals/dns_ssl.tf
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,55 @@ variable "services" {
name_prefix = "landregistrationdivision"
module_key = "ahmlr"
}
"care_standards" = {
name_prefix = "carestandards"
module_key = "care_standards"
},
"cicap" = {
name_prefix = "cicap"
module_key = "cicap"
}

"charity_tribunal_decisions" = {
name_prefix = "charitytribunal"
module_key = "charity_tribunal_decisions"
},
"claims_management_decisions" = {
name_prefix = "claimsmanagement"
module_key = "claims_management_decisions"
},
"consumer_credit_appeals" = {
name_prefix = "consumercreditappeals"
module_key = "consumer_credit_appeals"
},
"estate_agent_appeals" = {
name_prefix = "estateagentappeals"
module_key = "estate_agent_appeals"
},
"primary_health_lists" = {
name_prefix = "primaryhealthlists"
module_key = "primary_health_lists"
},
"siac" = {
name_prefix = "siac"
module_key = "siac"
},
"sscs_venue_pages" = {
name_prefix = "sscsvenues"
module_key = "sscs_venue_pages"
},
"tax_chancery_decisions" = {
name_prefix = "taxchancerydecisions"
module_key = "tax_chancery_decisions"
},
"tax_tribunal_decisions" = {
name_prefix = "taxtribunaldecisions"
module_key = "tax_tribunal_decisions"
},
"ftp_admin_appeals" = {
name_prefix = "adminappealsreports"
module_key = "ftp_admin_appeals"
}
}
}

Expand All @@ -65,6 +114,38 @@ variable "sftp_services" {
"claims_management_decisions" = {
name_prefix = "claimsmanagement"
module_key = "claims_management_decisions"
},
"consumer_credit_appeals" = {
name_prefix = "consumercreditappeals"
module_key = "consumer_credit_appeals"
},
"estate_agent_appeals" = {
name_prefix = "estateagentappeals"
module_key = "estate_agent_appeals"
},
"primary_health_lists" = {
name_prefix = "primaryhealthlists"
module_key = "primary_health_lists"
},
"siac" = {
name_prefix = "siac"
module_key = "siac"
},
"sscs_venue_pages" = {
name_prefix = "sscsvenues"
module_key = "sscs_venue_pages"
},
"tax_chancery_decisions" = {
name_prefix = "taxchancerydecisions"
module_key = "tax_chancery_decisions"
},
"tax_tribunal_decisions" = {
name_prefix = "taxtribunaldecisions"
module_key = "tax_tribunal_decisions"
},
"ftp_admin_appeals" = {
name_prefix = "adminappealsreports"
module_key = "ftp_admin_appeals"
}
}
}
Expand All @@ -73,10 +154,30 @@ locals {
modules = {
appeals = module.appeals
ahmlr = module.ahmlr
care_standards = module.care_standards
cicap = module.cicap
charity_tribunal_decisions = module.charity_tribunal_decisions
claims_management_decisions = module.claims_management_decisions
consumer_credit_appeals = module.consumer_credit_appeals
estate_agent_appeals = module.estate_agent_appeals
primary_health_lists = module.primary_health_lists
siac = module.siac
sscs_venue_pages = module.sscs_venue_pages
tax_chancery_decisions = module.tax_chancery_decisions
tax_tribunal_decisions = module.tax_tribunal_decisions
ftp_admin_appeals = module.ftp_admin_appeals
}
sftp_modules = {
charity_tribunal_decisions = module.charity_tribunal_decisions
claims_management_decisions = module.claims_management_decisions
consumer_credit_appeals = module.consumer_credit_appeals
estate_agent_appeals = module.estate_agent_appeals
primary_health_lists = module.primary_health_lists
siac = module.siac
sscs_venue_pages = module.sscs_venue_pages
tax_chancery_decisions = module.tax_chancery_decisions
tax_tribunal_decisions = module.tax_tribunal_decisions
ftp_admin_appeals = module.ftp_admin_appeals
}
}

Expand Down
Loading

0 comments on commit 701cad7

Please sign in to comment.