Skip to content

Commit

Permalink
Merge pull request #9009 from ministryofjustice/date_2024_12_09
Browse files Browse the repository at this point in the history
GitHub Actions Code Formatter workflow
  • Loading branch information
ASTRobinson authored Dec 9, 2024
2 parents 6d5fb99 + 8eafafa commit e772f6c
Show file tree
Hide file tree
Showing 21 changed files with 105 additions and 105 deletions.
2 changes: 1 addition & 1 deletion terraform/environments/analytical-platform-compute/vpc.tf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ module "vpc" {
flow_log_cloudwatch_log_group_retention_in_days = local.vpc_flow_log_cloudwatch_log_group_retention_in_days
flow_log_max_aggregation_interval = local.vpc_flow_log_max_aggregation_interval
vpc_flow_log_tags = { Name = local.our_vpc_name }
flow_log_log_format = "$${version} $${account-id} $${interface-id} $${srcaddr} $${dstaddr} $${srcport} $${dstport} $${protocol} $${packets} $${bytes} $${start} $${end} $${action} $${log-status} $${vpc-id} $${subnet-id} $${instance-id} $${tcp-flags} $${type} $${pkt-srcaddr} $${pkt-dstaddr} $${region} $${az-id} $${sublocation-type} $${sublocation-id} $${pkt-src-aws-service} $${pkt-dst-aws-service} $${flow-direction} $${traffic-path}"
flow_log_log_format = "$${version} $${account-id} $${interface-id} $${srcaddr} $${dstaddr} $${srcport} $${dstport} $${protocol} $${packets} $${bytes} $${start} $${end} $${action} $${log-status} $${vpc-id} $${subnet-id} $${instance-id} $${tcp-flags} $${type} $${pkt-srcaddr} $${pkt-dstaddr} $${region} $${az-id} $${sublocation-type} $${sublocation-id} $${pkt-src-aws-service} $${pkt-dst-aws-service} $${flow-direction} $${traffic-path}"

public_subnet_tags = {
"kubernetes.io/role/elb" = 1
Expand Down
4 changes: 2 additions & 2 deletions terraform/environments/apex/lambda.tf
Original file line number Diff line number Diff line change
Expand Up @@ -213,8 +213,8 @@ resource "aws_lambda_layer_version" "backup_lambda" {
s3_bucket = aws_s3_bucket.backup_lambda.id
s3_key = "nodejs.zip"
source_code_hash = local.hash_value
# Since the nodejs.zip file has been added manually to the s3 bucket the source_code_hash would have to be computed and added manually as well anytime there's a change to nodejs.zip
# This command allows you to retrieve the hash - openssl dgst -sha256 -binary nodejs.zip | base64
# Since the nodejs.zip file has been added manually to the s3 bucket the source_code_hash would have to be computed and added manually as well anytime there's a change to nodejs.zip
# This command allows you to retrieve the hash - openssl dgst -sha256 -binary nodejs.zip | base64
compatible_runtimes = ["nodejs18.x"]
depends_on = [time_sleep.wait_for_provision_files] # This resource creation will be delayed to ensure object exists in the bucket
}
Expand Down
2 changes: 1 addition & 1 deletion terraform/environments/apex/waf.tf
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# }

locals {
ip_set_dev = [for ip in split("\n", chomp(file("${path.module}/aws_waf_ipset_dev.txt"))) : ip]
ip_set_dev = [for ip in split("\n", chomp(file("${path.module}/aws_waf_ipset_dev.txt"))) : ip]
ip_set_prod = [for ip in split("\n", chomp(file("${path.module}/aws_waf_ipset.txt"))) : ip]
ip_set_list = local.environment == "development" ? local.ip_set_dev : local.ip_set_prod
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,14 +218,14 @@ resource "aws_iam_role_policy_attachment" "lambda_put_metric_data_logging_attach
}

locals {
rendered_metric_template = templatefile("${path.module}/lambda/dms_replication_metric.py.tmpl",{oracle_db_instance_scheduling=var.oracle_db_instance_scheduling})
rendered_metric_template = templatefile("${path.module}/lambda/dms_replication_metric.py.tmpl", { oracle_db_instance_scheduling = var.oracle_db_instance_scheduling })
}

# Creates a ZIP file containing the contents of the lambda directory which
# contains a Python script to calculate and put the custom metric
data "archive_file" "lambda_dms_replication_metric_zip" {
type = "zip"
source_content = local.rendered_metric_template
type = "zip"
source_content = local.rendered_metric_template
source_content_filename = "dms_replication_metric.py"
output_path = "${path.module}/lambda/dms_replication_metric.zip"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ output "oracle_db_server_name" {
}

output "oracle_db_instance_scheduling" {
value = try(module.instance.aws_instance.tags.instance-scheduling,"default")
value = try(module.instance.aws_instance.tags.instance-scheduling, "default")
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ module "aws_s3_data_migrate" {
log_retention_in_days = local.lambda_log_retention_in_days

# Set timeout to the maximum of 900 seconds (15 minutes)
timeout = 900
timeout = 900

# Optional: Adjust memory size if needed
memory_size = 2048
memory_size = 2048

vpc_settings = {
subnet_ids = [data.aws_subnet.data_subnets_a.id, data.aws_subnet.data_subnets_b.id, data.aws_subnet.data_subnets_c.id]
Expand Down
4 changes: 2 additions & 2 deletions terraform/environments/digital-prison-reporting/locals.tf
Original file line number Diff line number Diff line change
Expand Up @@ -433,9 +433,9 @@ locals {
lambda_s3_data_migrate_handler = "dpr-s3-data-lifecycle-migration-lambda-v1.lambda_handler"
lambda_s3_data_migrate_runtime = "python3.11"
lambda_s3_data_migrate_tracing = "PassThrough"
lambda_s3_data_migrate_policies = [
lambda_s3_data_migrate_policies = [
"arn:aws:iam::${local.account_id}:policy/${local.s3_read_access_policy}",
"arn:aws:iam::${local.account_id}:policy/${local.kms_read_access_policy}",
"arn:aws:iam::${local.account_id}:policy/${local.s3_read_write_policy}"
"arn:aws:iam::${local.account_id}:policy/${local.s3_read_write_policy}"
]
}
14 changes: 7 additions & 7 deletions terraform/environments/digital-prison-reporting/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -850,13 +850,13 @@ module "s3_structured_bucket" {

# S3 Curated
module "s3_curated_bucket" {
source = "./modules/s3_bucket"
create_s3 = local.setup_buckets
name = "${local.project}-curated-zone-${local.env}"
custom_kms_key = local.s3_kms_arn
create_notification_queue = false # For SQS Queue
enable_lifecycle = true
enable_intelligent_tiering = false
source = "./modules/s3_bucket"
create_s3 = local.setup_buckets
name = "${local.project}-curated-zone-${local.env}"
custom_kms_key = local.s3_kms_arn
create_notification_queue = false # For SQS Queue
enable_lifecycle = true
enable_intelligent_tiering = false

tags = merge(
local.all_tags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ resource "aws_dms_s3_endpoint" "dms-s3-target-endpoint" {
parquet_timestamp_in_millisecond = false
include_op_for_full_load = true

max_file_size = 120000
cdc_max_batch_interval = 10
max_file_size = 120000
cdc_max_batch_interval = 10

depends_on = [aws_iam_policy.dms-s3-target-policy, aws_iam_policy.dms-operator-s3-policy]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ variable "identifier" {
#--------------------------------------------------------------

variable "target_backup_retention_period" {
type = string
type = string
# Days
default = "30"
description = "Retention of RDS backups"
Expand Down Expand Up @@ -187,7 +187,7 @@ variable "source_app_username" {
}

variable "source_backup_window" {
type = string
type = string
# 12:00AM-03:00AM AEST
default = "14:00-17:00"
description = "RDS backup window"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ variable "identifier" {
#--------------------------------------------------------------

variable "target_backup_window" {
type = string
type = string
# 12:00AM-03:00AM AEST
default = "14:00-17:00"
description = "RDS backup window"
Expand Down Expand Up @@ -189,7 +189,7 @@ variable "source_app_username" {
}

variable "source_backup_window" {
type = string
type = string
# 12:00AM-03:00AM AEST
default = "14:00-17:00"
description = "RDS backup window"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ resource "aws_dms_s3_endpoint" "dms-s3-target-endpoint" {
parquet_timestamp_in_millisecond = false
include_op_for_full_load = true

max_file_size = 120000
cdc_max_batch_interval = 10
max_file_size = 120000
cdc_max_batch_interval = 10

tags = merge(
var.tags,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ resource "aws_s3_bucket_lifecycle_configuration" "lifecycle" {
# Expiration logic for short-term and temporary categories
dynamic "expiration" {
for_each = var.lifecycle_category == "short_term" ? [{ days = 90 }] : (
var.lifecycle_category == "temporary" ? [{ days = 30 }] : [])
var.lifecycle_category == "temporary" ? [{ days = 30 }] : [])
content {
days = expiration.value.days
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
locals {
# Setting the IAM name that our Cloud Platform API will use to connect to this role
iam-dev = local.environment_shorthand == "dev" ? var.cloud-platform-iam-dev : ""
iam-test = local.environment_shorthand == "test" ? var.cloud-platform-iam-preprod : ""

iam-dev = local.environment_shorthand == "dev" ? var.cloud-platform-iam-dev : ""
iam-test = local.environment_shorthand == "test" ? var.cloud-platform-iam-preprod : ""
iam-preprod = local.environment_shorthand == "preprod" ? var.cloud-platform-iam-preprod : ""
iam-prod = local.environment_shorthand == "prod" ? var.cloud-platform-iam-prod : ""
iam-prod = local.environment_shorthand == "prod" ? var.cloud-platform-iam-prod : ""

resolved-cloud-platform-iam-role = coalesce(local.iam-dev, local.iam-test, local.iam-preprod, local.iam-prod)
}
Expand All @@ -30,14 +30,14 @@ variable "cloud-platform-iam-prod" {
module "cmt_front_end_assumable_role" {
#checkov:skip=CKV_TF_1:Module registry does not support commit hashes for versions
#checkov:skip=CKV_TF_2:Module registry does not support tags for versions
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role"
source = "terraform-aws-modules/iam/aws//modules/iam-assumable-role"
version = "5.48.0"

trusted_role_arns = [
local.resolved-cloud-platform-iam-role
]

create_role = true
create_role = true
role_requires_mfa = false

role_name = "cmt_read_emds_data_${local.environment_shorthand}"
Expand Down
2 changes: 1 addition & 1 deletion terraform/environments/long-term-storage/data.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ data "aws_iam_policy_document" "aws_transfer_assume_role_policy" {
effect = "Allow"

principals {
type = "Service"
type = "Service"
identifiers = ["transfer.amazonaws.com"]
}
actions = ["sts:AssumeRole"]
Expand Down
2 changes: 1 addition & 1 deletion terraform/environments/oas/ec2.tf
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ resource "aws_security_group" "ec2" {
protocol = "tcp"
cidr_blocks = [local.application_data.accounts[local.environment].outbound_access_cidr]
}
egress {
egress {
description = "Allow telnet to Portal - MoJo"
from_port = 3443
to_port = 3443
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ locals {
"/dev/xvdm" = { type = "gp3", size = 700 } # F:/ Storage
}
instance = merge(local.ec2_instances.bods.instance, {
instance_type = "r6i.2xlarge"
instance_type = "r6i.2xlarge"
disable_api_termination = true
})
cloudwatch_metric_alarms = null
Expand Down
4 changes: 2 additions & 2 deletions terraform/environments/ppud/eventbridge.tf
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ resource "aws_cloudwatch_event_rule" "daily_schedule_send_cpu_graph_prod" {
}

resource "aws_cloudwatch_event_target" "trigger_lambda_target_send_cpu_graph_prod" {
count = local.is-production == true ? 1 : 0
count = local.is-production == true ? 1 : 0
rule = aws_cloudwatch_event_rule.daily_schedule_send_cpu_graph_prod[0].name
target_id = "send_cpu_graph"
arn = aws_lambda_function.terraform_lambda_func_send_cpu_graph_prod[0].arn
Expand All @@ -46,7 +46,7 @@ resource "aws_cloudwatch_event_rule" "weekly_schedule_ppud_email_report_prod" {
}

resource "aws_cloudwatch_event_target" "trigger_lambda_target_ppud_email_report_prod" {
count = local.is-production == true ? 1 : 0
count = local.is-production == true ? 1 : 0
rule = aws_cloudwatch_event_rule.weekly_schedule_ppud_email_report_prod[0].name
target_id = "ppud_email_report"
arn = aws_lambda_function.terraform_lambda_func_ppud_email_report_prod[0].arn
Expand Down
18 changes: 9 additions & 9 deletions terraform/environments/ppud/iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -1172,14 +1172,14 @@ resource "aws_iam_policy" "iam_policy_for_lambda_cloudwatch_get_metric_data_dev"
"Version" : "2012-10-17",
"Statement" : [
{
"Sid" : "CloudwatchMetricPolicy",
"Effect" : "Allow",
"Action" : [
"cloudwatch:*"
],
"Resource" : [
"arn:aws:cloudwatch:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:*"
]
"Sid" : "CloudwatchMetricPolicy",
"Effect" : "Allow",
"Action" : [
"cloudwatch:*"
],
"Resource" : [
"arn:aws:cloudwatch:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:*"
]
},
{
"Sid" : "S3BucketPolicy",
Expand Down Expand Up @@ -1242,7 +1242,7 @@ resource "aws_iam_policy" "iam_policy_for_lambda_cloudwatch_get_metric_data_dev"
"arn:aws:ses:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:*",
"arn:aws:ses:eu-west-2:${local.environment_management.account_ids["ppud-development"]}:identity/internaltest.ppud.justice.gov.uk"
]
}
}
]
})
}
Expand Down
Loading

0 comments on commit e772f6c

Please sign in to comment.