Skip to content

Commit

Permalink
Merge pull request #7164 from ministryofjustice/date_2024_07_22
Browse files Browse the repository at this point in the history
GitHub Actions Code Formatter workflow
  • Loading branch information
ASTRobinson authored Jul 22, 2024
2 parents 7d549c2 + 97c857c commit bd7c76b
Show file tree
Hide file tree
Showing 19 changed files with 166 additions and 166 deletions.
38 changes: 19 additions & 19 deletions terraform/environments/cica-tariff/locals.tf
Original file line number Diff line number Diff line change
@@ -1,43 +1,43 @@
#### This file can be used to store locals specific to the member account ####
locals{
pubkey = {
"development" = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3Fq4UnSs9jsFRxG7WV/2g4C4gTaG+7J5p5oi3Eup27MMoNBGTQV64ZETq8Gzx0Dx9R5xnj/y1DT350om2cdcGUYUDu47mOY+VXXtJpzK94R5ZzN+74xjz/swTgJQaOY8iaeSNsILkFMm50xTr7gzSaAswL95RH8h1IibzheqmwkHtN97JEaXkJbhE/CYNPmJzUahNG05vEnBG4op7OG5oLi+7cvZlrnho9lpkWRcOgXaS/mQsMKb45plYCU52reWIZhO9IoxaXULoYybk617I0Blhe2IvYcXfWZGw5xrfJrPJFiiK5fmYGgMp0d1J730kKZ5sOh0Y7Bdf3XXefUIaHlKe95/rXQczw5EeMG+lRt6cOS3XAh4CquyvwY3Oj2HgDLE2JMQS3Y9k8dBpopUCGLvk7MnHMb4SLF4FEoaeJQdv07c6amOQm5Hk0l13TAzlQg+xkyW0y3aluLdAyH6fucbwFiUnAINm9tqem7ZGghWxaC6X9xBUpCDOWPO/3KjpLvPNRrmIgEfSh73o3Jks16Ef3f94XOCM+exO8mTuAYK3F6Uhc2I6xMb3Wp35PBOZbKBEZCeoDvyb841UKHd6LLrgQELEOG+xd3UzM24JMh2FEnbCj3orIw2Zj1B4Udyu2EyV7BLpUhMt/jNt9Jonf1MqVzn9M3JfjUQEjYwVqQ=="
}
cidr_cica_ss_a = "10.10.10.0/24"
cidr_cica_ss_b = "10.10.110.0/24"
locals {
pubkey = {
"development" = "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3Fq4UnSs9jsFRxG7WV/2g4C4gTaG+7J5p5oi3Eup27MMoNBGTQV64ZETq8Gzx0Dx9R5xnj/y1DT350om2cdcGUYUDu47mOY+VXXtJpzK94R5ZzN+74xjz/swTgJQaOY8iaeSNsILkFMm50xTr7gzSaAswL95RH8h1IibzheqmwkHtN97JEaXkJbhE/CYNPmJzUahNG05vEnBG4op7OG5oLi+7cvZlrnho9lpkWRcOgXaS/mQsMKb45plYCU52reWIZhO9IoxaXULoYybk617I0Blhe2IvYcXfWZGw5xrfJrPJFiiK5fmYGgMp0d1J730kKZ5sOh0Y7Bdf3XXefUIaHlKe95/rXQczw5EeMG+lRt6cOS3XAh4CquyvwY3Oj2HgDLE2JMQS3Y9k8dBpopUCGLvk7MnHMb4SLF4FEoaeJQdv07c6amOQm5Hk0l13TAzlQg+xkyW0y3aluLdAyH6fucbwFiUnAINm9tqem7ZGghWxaC6X9xBUpCDOWPO/3KjpLvPNRrmIgEfSh73o3Jks16Ef3f94XOCM+exO8mTuAYK3F6Uhc2I6xMb3Wp35PBOZbKBEZCeoDvyb841UKHd6LLrgQELEOG+xd3UzM24JMh2FEnbCj3orIw2Zj1B4Udyu2EyV7BLpUhMt/jNt9Jonf1MqVzn9M3JfjUQEjYwVqQ=="
}
cidr_cica_ss_a = "10.10.10.0/24"
cidr_cica_ss_b = "10.10.110.0/24"

#get snapshot IDs for each volume. Required to stop instance replacement on apply
block_device_mapping_xvde = {
#get snapshot IDs for each volume. Required to stop instance replacement on apply
block_device_mapping_xvde = {
for mapping in data.aws_ami.shared_ami.block_device_mappings : "0" => mapping
if mapping.device_name == "xvde"

}
snapshot_id_xvde = local.block_device_mapping_xvde[0].ebs.snapshot_id
block_device_mapping_xvdf = {
snapshot_id_xvde = local.block_device_mapping_xvde[0].ebs.snapshot_id

block_device_mapping_xvdf = {
for mapping in data.aws_ami.shared_ami.block_device_mappings : "1" => mapping
if mapping.device_name == "xvdf"
}
snapshot_id_xvdf = local.block_device_mapping_xvdf[1].ebs.snapshot_id
snapshot_id_xvdf = local.block_device_mapping_xvdf[1].ebs.snapshot_id

block_device_mapping_xvdg = {
block_device_mapping_xvdg = {
for mapping in data.aws_ami.shared_ami.block_device_mappings : "2" => mapping
if mapping.device_name == "xvdg"
}
snapshot_id_xvdg = local.block_device_mapping_xvdg[2].ebs.snapshot_id
snapshot_id_xvdg = local.block_device_mapping_xvdg[2].ebs.snapshot_id

block_device_mapping_xvdh = {
block_device_mapping_xvdh = {
for mapping in data.aws_ami.shared_ami.block_device_mappings : "3" => mapping
if mapping.device_name == "xvdh"
}
snapshot_id_xvdh = local.block_device_mapping_xvdh[3].ebs.snapshot_id
snapshot_id_xvdh = local.block_device_mapping_xvdh[3].ebs.snapshot_id

block_device_mapping_xvdi = {
block_device_mapping_xvdi = {
for mapping in data.aws_ami.shared_ami.block_device_mappings : "4" => mapping
if mapping.device_name == "xvdi"
}
snapshot_id_xvdi = local.block_device_mapping_xvdi[4].ebs.snapshot_id
snapshot_id_xvdi = local.block_device_mapping_xvdi[4].ebs.snapshot_id

block_device_mapping_merge = merge(local.block_device_mapping_xvde, local.block_device_mapping_xvdf, local.block_device_mapping_xvdg, local.block_device_mapping_xvdh, local.block_device_mapping_xvdi)
block_device_mapping_merge = merge(local.block_device_mapping_xvde, local.block_device_mapping_xvdf, local.block_device_mapping_xvdg, local.block_device_mapping_xvdh, local.block_device_mapping_xvdi)
}

28 changes: 14 additions & 14 deletions terraform/environments/cica-tariff/tariff_ec2_app.tf
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,47 @@ resource "aws_instance" "tariff_app" {
volume_size = 20
}
ebs_block_device {
device_name = "xvde"
device_name = "xvde"
delete_on_termination = true
encrypted = true
volume_size = 100
snapshot_id = local.snapshot_id_xvde
snapshot_id = local.snapshot_id_xvde

}
ebs_block_device {
device_name = "xvdf"
ebs_block_device {
device_name = "xvdf"
delete_on_termination = true
encrypted = true
volume_size = 100
snapshot_id = local.snapshot_id_xvdf
snapshot_id = local.snapshot_id_xvdf
}
ebs_block_device {
device_name = "xvdg"
device_name = "xvdg"
delete_on_termination = true
encrypted = true
volume_size = 100
snapshot_id = local.snapshot_id_xvdg
}

ebs_block_device {
device_name = "xvdh"
device_name = "xvdh"
delete_on_termination = true
encrypted = true
volume_size = 16
snapshot_id = local.snapshot_id_xvdh
snapshot_id = local.snapshot_id_xvdh
}
ebs_block_device {
device_name = "xvdi"
device_name = "xvdi"
delete_on_termination = true
encrypted = true
volume_size = 30
snapshot_id = local.snapshot_id_xvdi
snapshot_id = local.snapshot_id_xvdi
}

volume_tags = merge(tomap({
"Name" = "${local.application_name}-app-root",
"volume-attach-host" = "app",
"volume-mount-path" = "/"
"Name" = "${local.application_name}-app-root",
"volume-attach-host" = "app",
"volume-mount-path" = "/"
}), local.tags)

tags = merge(tomap({
Expand Down
60 changes: 30 additions & 30 deletions terraform/environments/cica-tariff/tariff_vpc_endpoints.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@

#ssm
resource "aws_vpc_endpoint" "ssm" {
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.ssm"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
"Name" = lower(format("ssm-%s-endpoint", local.application_name)),
"hostname" = "${local.application_name}-app",
}), local.tags)

}

resource "aws_vpc_endpoint" "ec2messages" {
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.ec2messages"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.ec2messages"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
"Name" = lower(format("ec2-messages-%s-endpoint", local.application_name)),
"hostname" = "${local.application_name}-app",
}), local.tags)
Expand All @@ -28,46 +28,46 @@ resource "aws_vpc_endpoint" "ec2messages" {


resource "aws_vpc_endpoint" "ec2" {
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.ec2"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.ec2"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
"Name" = lower(format("ec2-%s-endpoint", local.application_name)),
"hostname" = "${local.application_name}-app",
}), local.tags)

}
resource "aws_vpc_endpoint" "ssm_messages" {
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.ssmmessages"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.ssmmessages"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
"Name" = lower(format("ssm-messages-%s-endpoint", local.application_name)),
"hostname" = "${local.application_name}-app",
}), local.tags)

}

resource "aws_vpc_endpoint" "kms" {
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.kms"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.kms"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
"Name" = lower(format("kms-%s-endpoint", local.application_name)),
"hostname" = "${local.application_name}-app",
}), local.tags)

}

resource "aws_vpc_endpoint" "logs" {
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.logs"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
vpc_id = data.aws_vpc.shared.id
service_name = "com.amazonaws.eu-west-2.logs"
vpc_endpoint_type = "Interface"
subnet_ids = data.aws_subnets.shared-private.ids
tags = merge(tomap({
"Name" = lower(format("logs-%s-endpoint", local.application_name)),
"hostname" = "${local.application_name}-app",
}), local.tags)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"smtp_instance_type": "t2.large",
"old_mail_server_url": "mail.aws.dev.legalservices.gov.uk",
"old_domain_name": "dev.legalservices.gov.uk"

},
"test": {
"example_var": "test-data"
Expand Down
4 changes: 2 additions & 2 deletions terraform/environments/contract-work-administration/ses.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ resource "aws_sesv2_email_identity" "cwa" {
email_identity = local.environment == "production" ? "tbc" : data.aws_route53_zone.external.name
configuration_set_name = local.environment == "production" ? aws_sesv2_configuration_set.cwa[0].configuration_set_name : null
dkim_signing_attributes {
next_signing_key_length = "RSA_1024_BIT"
next_signing_key_length = "RSA_1024_BIT"
}
tags = local.tags
}
Expand Down Expand Up @@ -142,7 +142,7 @@ resource "aws_secretsmanager_secret" "smtp_sesrsa" {
## TODO Create Kinesis Data Firehose and IAM role for Production, then enable below to set event destination

resource "aws_sesv2_configuration_set" "cwa" {
count = contains(["production"], local.environment) ? 1 : 0
count = contains(["production"], local.environment) ? 1 : 0
configuration_set_name = "${local.environment}-configuration-set"

delivery_options {
Expand Down
28 changes: 14 additions & 14 deletions terraform/environments/contract-work-administration/smtp.tf
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,14 @@ EOF
######################################

resource "aws_instance" "smtp" {
ami = local.application_data.accounts[local.environment].smtp_ami_id
availability_zone = "eu-west-2a"
instance_type = local.application_data.accounts[local.environment].smtp_instance_type
monitoring = true
vpc_security_group_ids = [aws_security_group.smtp.id]
subnet_id = data.aws_subnet.data_subnets_a.id
iam_instance_profile = aws_iam_instance_profile.smtp.id
# key_name = aws_key_pair.cwa.key_name
ami = local.application_data.accounts[local.environment].smtp_ami_id
availability_zone = "eu-west-2a"
instance_type = local.application_data.accounts[local.environment].smtp_instance_type
monitoring = true
vpc_security_group_ids = [aws_security_group.smtp.id]
subnet_id = data.aws_subnet.data_subnets_a.id
iam_instance_profile = aws_iam_instance_profile.smtp.id
# key_name = aws_key_pair.cwa.key_name
user_data_base64 = base64encode(local.smtp_userdata)
user_data_replace_on_change = true
metadata_options {
Expand Down Expand Up @@ -92,11 +92,11 @@ resource "aws_vpc_security_group_egress_rule" "smtp_outbound" {
}

resource "aws_vpc_security_group_ingress_rule" "smtp_vpc" {
security_group_id = aws_security_group.smtp.id
description = "SMTP access"
cidr_ipv4 = data.aws_vpc.shared.cidr_block
from_port = 25
ip_protocol = "tcp"
to_port = 25
security_group_id = aws_security_group.smtp.id
description = "SMTP access"
cidr_ipv4 = data.aws_vpc.shared.cidr_block
from_port = 25
ip_protocol = "tcp"
to_port = 25
}

18 changes: 9 additions & 9 deletions terraform/environments/delius-mis/locals_preproduction.tf
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,15 @@ locals {
ebs_volumes = {
"/dev/sdb" = { label = "app", size = 200 } # /u01
"/dev/sdc" = { label = "app", size = 100 } # /u02
"/dev/sdf" = { label = "data" } # DATA
"/dev/sdg" = { label = "data" } # DATA
"/dev/sdh" = { label = "data" } # DATA
"/dev/sdi" = { label = "data" } # DATA
"/dev/sdj" = { label = "data" } # DATA
"/dev/sdk" = { label = "flash" } # FLASH
"/dev/sdl" = { label = "flash" } # FLASH
"/dev/sdm" = { label = "flash" } # FLASH
"/dev/sdn" = { label = "flash" } # FLASH
"/dev/sdf" = { label = "data" } # DATA
"/dev/sdg" = { label = "data" } # DATA
"/dev/sdh" = { label = "data" } # DATA
"/dev/sdi" = { label = "data" } # DATA
"/dev/sdj" = { label = "data" } # DATA
"/dev/sdk" = { label = "flash" } # FLASH
"/dev/sdl" = { label = "flash" } # FLASH
"/dev/sdm" = { label = "flash" } # FLASH
"/dev/sdn" = { label = "flash" } # FLASH
"/dev/sds" = { label = "swap" }
}
ebs_volume_config = {
Expand Down
18 changes: 9 additions & 9 deletions terraform/environments/delius-mis/locals_stage.tf
Original file line number Diff line number Diff line change
Expand Up @@ -340,15 +340,15 @@ locals {
ebs_volumes = {
"/dev/sdb" = { label = "app", size = 200 } # /u01
"/dev/sdc" = { label = "app", size = 100 } # /u02
"/dev/sdf" = { label = "data" } # DATA
"/dev/sdg" = { label = "data" } # DATA
"/dev/sdh" = { label = "data" } # DATA
"/dev/sdi" = { label = "data" } # DATA
"/dev/sdj" = { label = "data" } # DATA
"/dev/sdk" = { label = "flash" } # FLASH
"/dev/sdl" = { label = "flash" } # FLASH
"/dev/sdm" = { label = "flash" } # FLASH
"/dev/sdn" = { label = "flash" } # FLASH
"/dev/sdf" = { label = "data" } # DATA
"/dev/sdg" = { label = "data" } # DATA
"/dev/sdh" = { label = "data" } # DATA
"/dev/sdi" = { label = "data" } # DATA
"/dev/sdj" = { label = "data" } # DATA
"/dev/sdk" = { label = "flash" } # FLASH
"/dev/sdl" = { label = "flash" } # FLASH
"/dev/sdm" = { label = "flash" } # FLASH
"/dev/sdn" = { label = "flash" } # FLASH
"/dev/sds" = { label = "swap" }
}
ebs_volume_config = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -574,22 +574,24 @@
"enable_dbt_k8s_secrets": true,
"dpr_generic_athena_workgroup": true,
"analytics_generic_athena_workgroup": true,
"analytical_platform_share": [{
"target_account_name": "analytical-platform-data-production",
"target_account_id": "593291632749",
"assume_account_name": "analytical-platform-management-production",
"assume_account_id": "042130406152",
"data_locations": [
"dpr-structured-historical-preproduction"
],
"resource_shares": [{
"glue_database": "curated_prisons_history_preprod_dbt",
"glue_tables": [
"nomis_offender_course_attendances",
"nomis_offender_program_profiles"
]
}]
}]
"analytical_platform_share": [
{
"target_account_name": "analytical-platform-data-production",
"target_account_id": "593291632749",
"assume_account_name": "analytical-platform-management-production",
"assume_account_id": "042130406152",
"data_locations": ["dpr-structured-historical-preproduction"],
"resource_shares": [
{
"glue_database": "curated_prisons_history_preprod_dbt",
"glue_tables": [
"nomis_offender_course_attendances",
"nomis_offender_program_profiles"
]
}
]
}
]
},
"production": {
"project_short_id": "dpr",
Expand Down
2 changes: 1 addition & 1 deletion terraform/environments/digital-prison-reporting/outputs.tf
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ output "cluster_nodes" {
output "ec2_private_key" {
description = "Ec2 Private Key"
value = module.ec2_kinesis_agent.private_key
sensitive = true
sensitive = true
}

# DMS Subnet ids
Expand Down
Loading

0 comments on commit bd7c76b

Please sign in to comment.