File tree Expand file tree Collapse file tree 2 files changed +46
-7
lines changed
Expand file tree Collapse file tree 2 files changed +46
-7
lines changed Original file line number Diff line number Diff line change @@ -239,7 +239,46 @@ resource "aws_iam_role_policy_attachment" "api_gateway_logs" {
239239 policy_arn = " arn:aws:iam::aws:policy/service-role/AmazonAPIGatewayPushToCloudWatchLogs"
240240}
241241
242+
242243resource "aws_api_gateway_account" "logging" {
243244 count = local. is_sandbox ? 0 : 1
244245 cloudwatch_role_arn = aws_iam_role. api_gateway_cloudwatch [0 ]. arn
245246}
247+
248+ data "aws_iam_policy_document" "assume_role_policy_get_document_review_lambda" {
249+ statement {
250+ actions = [" sts:AssumeRole" ]
251+
252+ principals {
253+ type = " AWS"
254+ identifiers = [module . get_document_review_lambda . lambda_execution_role_arn ]
255+ }
256+ }
257+ }
258+
259+ resource "aws_iam_role" "get_document_review_presign" {
260+ name = " ${ terraform . workspace } _stitch_presign_url_role"
261+ assume_role_policy = data. aws_iam_policy_document . assume_role_policy_get_document_review_lambda . json
262+ }
263+
264+ resource "aws_iam_role_policy_attachment" "get_document_review" {
265+ role = aws_iam_role. get_document_review_presign . name
266+ policy_arn = aws_iam_policy. s3_document_data_policy_get_document_review_lambda . arn
267+ }
268+
269+ resource "aws_iam_policy" "s3_document_data_policy_get_document_review_lambda" {
270+ name = " ${ terraform . workspace } _get_document_only_policy_for_get_document_review_lambda"
271+
272+ policy = jsonencode ({
273+ " Version" : " 2012-10-17" ,
274+ " Statement" : [
275+ {
276+ " Effect" : " Allow" ,
277+ " Action" : [
278+ " s3:GetObject" ,
279+ ],
280+ " Resource" : [" *" ]
281+ }
282+ ]
283+ })
284+ }
Original file line number Diff line number Diff line change @@ -15,13 +15,13 @@ module "get_document_review_lambda" {
1515 is_gateway_integration_needed = true
1616 is_invoked_from_gateway = true
1717 lambda_environment_variables = {
18- APPCONFIG_APPLICATION = module.ndr- app- config.app_config_application_id
19- APPCONFIG_ENVIRONMENT = module.ndr- app- config.app_config_environment_id
20- APPCONFIG_CONFIGURATION = module.ndr- app- config.app_config_configuration_profile_id
21- DOCUMENT_REVIEW_DYNAMO_NAME = " "
22- EDGE_REFERENCE_TABLE = module.cloudfront_edge_dynamodb_table.table_name
23- CLOUDFRONT_URL = module.cloudfront- distribution- lg.cloudfront_url
24- WORKSPACE = terraform.workspace
18+ APPCONFIG_APPLICATION = module.ndr- app- config.app_config_application_id
19+ APPCONFIG_ENVIRONMENT = module.ndr- app- config.app_config_environment_id
20+ APPCONFIG_CONFIGURATION = module.ndr- app- config.app_config_configuration_profile_id
21+ DOCUMENT_REVIEW_DYNAMO_NAME = " "
22+ EDGE_REFERENCE_TABLE = module.cloudfront_edge_dynamodb_table.table_name
23+ CLOUDFRONT_URL = module.cloudfront- distribution- lg.cloudfront_url
24+ WORKSPACE = terraform.workspace
2525 }
2626 depends_on = [
2727 aws_api_gateway_rest_api . ndr_doc_store_api ,
You can’t perform that action at this time.
0 commit comments