@@ -3,18 +3,8 @@ locals {
33 filename_lambda_dir = abspath (" ${ path . root } /../../lambdas/filenameprocessor" )
44 filename_lambda_files = fileset (local. filename_lambda_dir , " **" )
55 filename_lambda_dir_sha = sha1 (join (" " , [for f in local . filename_lambda_files : filesha1 (" ${ local . filename_lambda_dir } /${ f } " )]))
6- dps_bucket_name_for_extended_attribute = (
7- var. environment == " prod"
8- ? " nhsd-dspp-core-prod-extended-attributes-gdp"
9- : " nhsd-dspp-core-ref-extended-attributes-gdp"
10- )
11- dps_bucket_arn_for_extended_attribute = [
12- " arn:aws:s3:::${ local . dps_bucket_name_for_extended_attribute } /*"
13- ]
146}
157
16-
17-
188resource "aws_ecr_repository" "file_name_processor_lambda_repository" {
199 image_scanning_configuration {
2010 scan_on_push = true
@@ -178,7 +168,7 @@ resource "aws_iam_policy" "filenameprocessor_lambda_exec_policy" {
178168 " Action" : [
179169 " s3:PutObject"
180170 ],
181- " Resource" : local.dps_bucket_arn_for_extended_attribute
171+ " Resource" : [ " arn:aws:s3::: ${ var . dspp_submission_s3_bucket_name } /* " ]
182172 }
183173 ]
184174 })
@@ -264,14 +254,14 @@ resource "aws_iam_policy" "filenameprocessor_dps_extended_attribute_kms_policy"
264254 {
265255 Effect = " Allow" ,
266256 Action = [
267- " kms:Decrypt " ,
257+ " kms:Encrypt " ,
268258 " kms:GenerateDataKey" ,
269- " kms:DescribeKey"
259+ " kms:DescribeKey" ,
270260 ],
271261 Resource = " arn:aws:kms:eu-west-2:${ var . dspp_core_account_id } :key/*" ,
272262 " Condition" = {
273263 " ForAnyValue:StringEquals" = {
274- " kms:ResourceAliases" = " alias/${ var . dspp_kms_key_alias } "
264+ " kms:ResourceAliases" = " alias/${ var . dspp_submission_kms_key_alias } "
275265 }
276266 }
277267 }
@@ -329,7 +319,7 @@ resource "aws_lambda_function" "file_processor_lambda" {
329319 DPS_ACCOUNT_ID = var.dspp_core_account_id
330320 SOURCE_BUCKET_NAME = aws_s3_bucket.batch_data_source_bucket.bucket
331321 ACK_BUCKET_NAME = aws_s3_bucket.batch_data_destination_bucket.bucket
332- DPS_BUCKET_NAME = local.dps_bucket_name_for_extended_attribute
322+ DPS_BUCKET_NAME = var.dspp_submission_s3_bucket_name
333323 QUEUE_URL = aws_sqs_queue.batch_file_created.url
334324 REDIS_HOST = data.aws_elasticache_cluster.existing_redis.cache_nodes[0 ].address
335325 REDIS_PORT = data.aws_elasticache_cluster.existing_redis.cache_nodes[0 ].port
0 commit comments