Skip to content

Commit

Permalink
Merge pull request #6804 from ministryofjustice/date_2024_07_01
Browse files Browse the repository at this point in the history
GitHub Actions Code Formatter workflow
  • Loading branch information
dms1981 authored Jul 1, 2024
2 parents 49adf0d + 4f8c2c5 commit 5e0c6ea
Show file tree
Hide file tree
Showing 17 changed files with 161 additions and 161 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
resource "aws_ec2_transit_gateway_vpc_attachment" "pttp" {
transit_gateway_id = data.aws_ec2_transit_gateway.pttp.id
# transit_gateway_id = data.aws_arn.moj_tgw.resource
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets
vpc_id = module.vpc.vpc_id
subnet_ids = module.vpc.private_subnets

tags = local.tags
}
8 changes: 4 additions & 4 deletions terraform/environments/cdpt-ifs/route53.tf
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ resource "aws_route53_record" "external" {
type = "A"

alias {
name = aws_lb.ifs_lb.dns_name
zone_id = aws_lb.ifs_lb.zone_id
name = aws_lb.ifs_lb.dns_name
zone_id = aws_lb.ifs_lb.zone_id
# name = module.lb_access_logs_enabled.load_balancer.dns_name
# zone_id = module.lb_access_logs_enabled.load_balancer.zone_id
evaluate_target_health = true
Expand Down Expand Up @@ -108,8 +108,8 @@ resource "aws_route53_record" "external_prod" {
type = "A"

alias {
name = aws_lb.ifs_lb.dns_name
zone_id = aws_lb.ifs_lb.zone_id
name = aws_lb.ifs_lb.dns_name
zone_id = aws_lb.ifs_lb.zone_id
# name = module.lb_access_logs_enabled.load_balancer.dns_name
# zone_id = module.lb_access_logs_enabled.load_balancer.zone_id
evaluate_target_health = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,15 @@ resource "aws_s3_object" "config" {
from_address = "replace"
domain = "replace"
}
fileshare_user_base = "ou=Fileshare,ou=Users,dc=moj,dc=com;ou=Users,dc=moj,dc=com"
standard_user_base = "ou=Users,dc=moj,dc=com"
fs_group_prefix = "RES-FS"
ldap_host = "ldap.dev.delius-core.hmpps-development.modernisation-platform.internal"
pwm_url = "pwm.dev.delius-core.hmpps-development.modernisation-platform.service.justice.gov.uk"
fileshare_base_groups = "ou=Fileshare,ou=Groups,dc=moj,dc=com"
ldap_user = "cn=admin,ou=Users,dc=moj,dc=com"

fileshare_user_base = "ou=Fileshare,ou=Users,dc=moj,dc=com;ou=Users,dc=moj,dc=com"
standard_user_base = "ou=Users,dc=moj,dc=com"
fs_group_prefix = "RES-FS"
ldap_host = "ldap.dev.delius-core.hmpps-development.modernisation-platform.internal"
pwm_url = "pwm.dev.delius-core.hmpps-development.modernisation-platform.service.justice.gov.uk"
fileshare_base_groups = "ou=Fileshare,ou=Groups,dc=moj,dc=com"
ldap_user = "cn=admin,ou=Users,dc=moj,dc=com"

}
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@
},
"setup_cw_insights": false,
"enable_cp_k8s_secrets": false,
"enable_cp_bodmis_k8s_secrets": false,
"enable_cp_bodmis_k8s_secrets": false,
"enable_dbt_k8s_secrets": true,
"dpr_generic_athena_workgroup": true,
"analytics_generic_athena_workgroup": true
Expand Down Expand Up @@ -761,7 +761,7 @@
},
"setup_cw_insights": false,
"enable_cp_k8s_secrets": false,
"enable_cp_bodmis_k8s_secrets": false,
"enable_cp_bodmis_k8s_secrets": false,
"enable_dbt_k8s_secrets": true,
"dpr_generic_athena_workgroup": true,
"analytics_generic_athena_workgroup": true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@ module "athena_workgroup_dpr_generic" {

setup_athena_workgroup = local.setup_dpr_generic_athena_workgroup

name = format("%s-generic-athena-workgroup", local.project )
state_enabled = true
name = format("%s-generic-athena-workgroup", local.project)
state_enabled = true
output_location = format("s3://%s/%s", module.s3_working_bucket.bucket_id, local.project)

tags = merge(
local.all_tags,
{
Resource_Group = "Athena"
Resource_Type = "Athena-Workgroup"
Jira = "DPR2-716"
project = local.project
Name = format("%s-generic-athena-workgroup", local.project )
Resource_Group = "Athena"
Resource_Type = "Athena-Workgroup"
Jira = "DPR2-716"
project = local.project
Name = format("%s-generic-athena-workgroup", local.project)
}
)
)

}

Expand All @@ -25,18 +25,18 @@ module "athena_workgroup_analytics_generic" {

setup_athena_workgroup = local.setup_analytics_generic_athena_workgroup

name = format("%s-generic-athena-workgroup", local.analytics_project_id )
state_enabled = true
name = format("%s-generic-athena-workgroup", local.analytics_project_id)
state_enabled = true
output_location = format("s3://%s/%s", module.s3_working_bucket.bucket_id, local.analytics_project_id)

tags = merge(
local.all_tags,
{
Resource_Group = "Athena"
Resource_Type = "Athena-Workgroup"
Jira = "DPR2-716"
project = local.analytics_project_id
Name = format("%s-generic-athena-workgroup", local.analytics_project_id )
Resource_Group = "Athena"
Resource_Type = "Athena-Workgroup"
Jira = "DPR2-716"
project = local.analytics_project_id
Name = format("%s-generic-athena-workgroup", local.analytics_project_id)
}
)
}
4 changes: 2 additions & 2 deletions terraform/environments/digital-prison-reporting/locals.tf
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#### This file can be used to store locals specific to the member account ####
#### DPR Specific ####
locals {
project = local.application_data.accounts[local.environment].project_short_id
project = local.application_data.accounts[local.environment].project_short_id
analytics_project_id = "analytics"

other_log_retention_in_days = local.application_data.accounts[local.environment].other_log_retention_in_days
Expand Down Expand Up @@ -299,7 +299,7 @@ locals {
enable_cw_insights = local.application_data.accounts[local.environment].setup_cw_insights

# Setup Athena Workgroups
setup_dpr_generic_athena_workgroup = local.application_data.accounts[local.environment].dpr_generic_athena_workgroup
setup_dpr_generic_athena_workgroup = local.application_data.accounts[local.environment].dpr_generic_athena_workgroup
setup_analytics_generic_athena_workgroup = local.application_data.accounts[local.environment].analytics_generic_athena_workgroup

# Sonatype Secrets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

resource "aws_athena_workgroup" "main" {
count = var.setup_athena_workgroup ? 1 : 0
count = var.setup_athena_workgroup ? 1 : 0

name = var.name
description = length(var.description) > 0 ? var.description : format("The workgroup for %s.", var.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ resource "aws_athena_workgroup" "default" {
bytes_scanned_cutoff_per_query = 1073741824 # 1 GB
enforce_workgroup_configuration = true
publish_cloudwatch_metrics_enabled = true

result_configuration {
output_location = "s3://${module.athena-s3-bucket.bucket.id}/output/"

Expand Down
106 changes: 53 additions & 53 deletions terraform/environments/electronic-monitoring-data/dms_iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -19,66 +19,66 @@ resource "aws_iam_policy" "dms_ep_s3_role_policy" {
name = "dms-s3-target-ep-policy"
policy = jsonencode(
{
"Version": "2012-10-17",
"Statement": [
"Version" : "2012-10-17",
"Statement" : [
{
"Sid": "AthenaDMS",
"Effect": "Allow",
"Action": [
"athena:StartQueryExecution",
"athena:GetQueryExecution",
"athena:CreateWorkGroup"
],
"Resource": "arn:aws:athena:eu-west-2:${local.env_account_id}:workgroup/dms_validation_workgroup_for_task_*"
"Sid" : "AthenaDMS",
"Effect" : "Allow",
"Action" : [
"athena:StartQueryExecution",
"athena:GetQueryExecution",
"athena:CreateWorkGroup"
],
"Resource" : "arn:aws:athena:eu-west-2:${local.env_account_id}:workgroup/dms_validation_workgroup_for_task_*"
},
{
"Effect": "Allow",
"Action": [
"glue:CreateDatabase",
"glue:DeleteDatabase",
"glue:GetDatabase",
"glue:GetTables",
"glue:CreateTable",
"glue:DeleteTable",
"glue:GetTable"
],
"Resource": [
"arn:aws:glue:eu-west-2:${local.env_account_id}:catalog",
"arn:aws:glue:eu-west-2:${local.env_account_id}:database/aws_dms_s3_validation_*",
"arn:aws:glue:eu-west-2:${local.env_account_id}:table/aws_dms_s3_validation_*/*",
"arn:aws:glue:eu-west-2:${local.env_account_id}:userDefinedFunction/aws_dms_s3_validation_*/*"
]
"Effect" : "Allow",
"Action" : [
"glue:CreateDatabase",
"glue:DeleteDatabase",
"glue:GetDatabase",
"glue:GetTables",
"glue:CreateTable",
"glue:DeleteTable",
"glue:GetTable"
],
"Resource" : [
"arn:aws:glue:eu-west-2:${local.env_account_id}:catalog",
"arn:aws:glue:eu-west-2:${local.env_account_id}:database/aws_dms_s3_validation_*",
"arn:aws:glue:eu-west-2:${local.env_account_id}:table/aws_dms_s3_validation_*/*",
"arn:aws:glue:eu-west-2:${local.env_account_id}:userDefinedFunction/aws_dms_s3_validation_*/*"
]
},
{
"Action": [
"s3:GetBucketLocation",
"s3:ListBucket",
"s3:ListBucketMultipartUploads",
"s3:AbortMultipartUpload",
"s3:ListMultipartUploadParts"
],
"Effect": "Allow",
"Resource": [
"${aws_s3_bucket.dms_target_ep_s3_bucket.arn}",
"${module.athena-s3-bucket.bucket.arn}"
],
"Sid": "DMSAccess"
"Action" : [
"s3:GetBucketLocation",
"s3:ListBucket",
"s3:ListBucketMultipartUploads",
"s3:AbortMultipartUpload",
"s3:ListMultipartUploadParts"
],
"Effect" : "Allow",
"Resource" : [
"${aws_s3_bucket.dms_target_ep_s3_bucket.arn}",
"${module.athena-s3-bucket.bucket.arn}"
],
"Sid" : "DMSAccess"
},
{
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListBucketMultipartUploads",
"s3:AbortMultipartUpload",
"s3:ListMultipartUploadParts"
],
"Effect": "Allow",
"Resource": [
"${aws_s3_bucket.dms_target_ep_s3_bucket.arn}/*",
"${module.athena-s3-bucket.bucket.arn}/*"
],
"Sid": "DMSObjectActions"
"Action" : [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject",
"s3:ListBucketMultipartUploads",
"s3:AbortMultipartUpload",
"s3:ListMultipartUploadParts"
],
"Effect" : "Allow",
"Resource" : [
"${aws_s3_bucket.dms_target_ep_s3_bucket.arn}/*",
"${module.athena-s3-bucket.bucket.arn}/*"
],
"Sid" : "DMSObjectActions"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -432,8 +432,8 @@ data "aws_iam_policy_document" "output_fs_json_lambda_s3_policy_document" {
]
resources = [
"${aws_s3_bucket.data_store.arn}/*",
aws_s3_bucket.data_store.arn
]
aws_s3_bucket.data_store.arn
]
}
}

Expand Down
30 changes: 15 additions & 15 deletions terraform/environments/electronic-monitoring-data/lambdas_main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -219,21 +219,21 @@ module "query_output_to_list" {
# ------------------------------------------------------

module "update_log_table" {
source = "./modules/lambdas"
function_name = "update_log_table"
is_image = true
role_name = aws_iam_role.update_log_table.name
role_arn = aws_iam_role.update_log_table.arn
memory_size = 1024
timeout = 900
env_account_id = local.env_account_id
ecr_repo_name = module.ecr_lambdas_repo.repository_name
ecr_repo_url = module.ecr_lambdas_repo.repository_url
environment_variables = {
S3_LOG_BUCKET = aws_s3_bucket.dms_dv_parquet_s3_bucket.id
DATABASE_NAME = aws_glue_catalog_database.dms_dv_glue_catalog_db.name
TABLE_NAME = "glue_df_output"
}
source = "./modules/lambdas"
function_name = "update_log_table"
is_image = true
role_name = aws_iam_role.update_log_table.name
role_arn = aws_iam_role.update_log_table.arn
memory_size = 1024
timeout = 900
env_account_id = local.env_account_id
ecr_repo_name = module.ecr_lambdas_repo.repository_name
ecr_repo_url = module.ecr_lambdas_repo.repository_url
environment_variables = {
S3_LOG_BUCKET = aws_s3_bucket.dms_dv_parquet_s3_bucket.id
DATABASE_NAME = aws_glue_catalog_database.dms_dv_glue_catalog_db.name
TABLE_NAME = "glue_df_output"
}
}

#-----------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ output "repository_url" {
}

output "arn" {
value = aws_ecr_repository.ecr.arn
value = aws_ecr_repository.ecr.arn
}

output "repository_name" {
value = var.ecr_name
value = var.ecr_name
}
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ resource "aws_cloudwatch_log_group" "lambda_cloudwatch_group" {
}

data "external" "latest_image_update_log_table" {
for_each = var.is_image ? { image = 1 } : {} # Use empty map if not fetching image
for_each = var.is_image ? { image = 1 } : {} # Use empty map if not fetching image

program = ["bash", "${path.root}/bash_scripts/get_latest_image.sh", var.ecr_repo_name, var.function_name]
query = {
Expand All @@ -139,13 +139,13 @@ resource "aws_lambda_function" "this" {
source_code_hash = var.is_image ? null : var.source_code_hash
runtime = var.is_image ? null : var.runtime
# Image config
image_uri = var.is_image ? "${var.ecr_repo_url}:${data.external.latest_image_update_log_table["image"].result["latest_image_uri"]}" : null
package_type = var.is_image ? "Image" : null
image_uri = var.is_image ? "${var.ecr_repo_url}:${data.external.latest_image_update_log_table["image"].result["latest_image_uri"]}" : null
package_type = var.is_image ? "Image" : null
# Constants
function_name = var.function_name
role = var.role_arn
timeout = var.timeout
memory_size = var.memory_size
function_name = var.function_name
role = var.role_arn
timeout = var.timeout
memory_size = var.memory_size

dynamic "vpc_config" {
for_each = local.use_vpc_config ? [1] : []
Expand Down
Loading

0 comments on commit 5e0c6ea

Please sign in to comment.