File tree Expand file tree Collapse file tree 4 files changed +55
-8
lines changed
infrastructure/terraform/components/api Expand file tree Collapse file tree 4 files changed +55
-8
lines changed Original file line number Diff line number Diff line change 11resource "aws_lambda_event_source_mapping" "letter_updates_transformer_kinesis" {
2- event_source_arn = aws_kinesis_stream. letter_change_stream . arn
3- function_name = module. letter_updates_transformer . function_arn
4- starting_position = " LATEST"
5- batch_size = 10
6- maximum_batching_window_in_seconds = 1
2+ event_source_arn = aws_kinesis_stream. letter_change_stream . arn
3+ function_name = module. letter_updates_transformer . function_arn
4+ starting_position = " LATEST"
5+ batch_size = 10
6+ maximum_batching_window_in_seconds = 1
77
88 depends_on = [
9- module . letter_updates_transformer # ensures updates transformer exists
9+ module . letter_updates_transformer # ensures updates transformer exists
1010 ]
1111}
Original file line number Diff line number Diff line change @@ -28,4 +28,7 @@ locals {
2828 APIM_CORRELATION_HEADER = " nhsd-correlation-id" ,
2929 DOWNLOAD_URL_TTL_SECONDS = 60
3030 }
31+
32+ core_pdf_bucket_arn = " arn:aws:s3:::comms-${ var . core_account_id } -eu-west-2-${ var . core_environment } -api-stg-pdf-pipeline"
33+ core_s3_kms_key_alias_name = " alias/comms-${ var . core_environment } -api-s3"
3134}
Original file line number Diff line number Diff line change @@ -68,11 +68,43 @@ data "aws_iam_policy_document" "get_letter_data_lambda" {
6868 ]
6969 }
7070
71+ statement {
72+ sid = " S3ListBucketForPresign"
73+ actions = [
74+ " s3:ListBucket"
75+ ]
76+ resources = [
77+ module . s3bucket_test_letters . arn ,
78+ local . core_pdf_bucket_arn
79+ ]
80+ }
81+
7182 statement {
7283 sid = " S3GetObjectForPresign"
7384 actions = [
7485 " s3:GetObject" ,
75- " s3:ListBucket" ] # allows 404 response instead of 403 if object missing
76- resources = [" ${ module . s3bucket_test_letters . arn } /*" ]
86+ " s3:PutObject" ,
87+ ] # allows 404 response instead of 403 if object missing
88+ resources = [
89+ " ${ module . s3bucket_test_letters . arn } /*" ,
90+ " ${ local . core_pdf_bucket_arn } /*" ,
91+ ]
92+ }
93+
94+ statement {
95+ sid = " KMSForCoreS3Access"
96+ actions = [
97+ " kms:Decrypt" ,
98+ " kms:GenerateDataKey" ,
99+ " kms:DescribeKey"
100+ ]
101+ resources = [
102+ " arn:aws:kms:${ var . region } :${ var . core_account_id } :key/*"
103+ ]
104+ condition {
105+ test = " ForAnyValue:StringEquals"
106+ variable = " kms:ResourceAliases"
107+ values = [local . core_s3_kms_key_alias_name ]
108+ }
77109 }
78110}
Original file line number Diff line number Diff line change @@ -134,3 +134,15 @@ variable "eventpub_control_plane_bus_arn" {
134134 description = " ARN of the EventBridge control plane bus for eventpub"
135135 default = " "
136136}
137+
138+ variable "core_account_id" {
139+ type = string
140+ description = " AWS Account ID for Core"
141+ default = " 000000000000"
142+ }
143+
144+ variable "core_environment" {
145+ type = string
146+ description = " Environment of Core"
147+ default = " prod"
148+ }
You can’t perform that action at this time.
0 commit comments