44 policy_path = " ${ path . root } /policies"
55}
66
7- # Select the Policy folder
87data "aws_iam_policy_document" "logs_policy_document" {
98 source_policy_documents = [templatefile (" ${ local . policy_path } /log.json" , {})]
109}
@@ -59,20 +58,6 @@ data "aws_iam_policy_document" "imms_policy_document" {
5958 ]
6059}
6160
62- data "aws_iam_policy_document" "imms_data_quality_s3_doc" {
63- source_policy_documents = [
64- templatefile (" ${ local . policy_path } /s3_data_quality_access.json" , {
65- s3_bucket_arn = aws_s3_bucket.data_quality_reports_bucket.arn
66- kms_key_arn = data.aws_kms_key.existing_s3_encryption_key.arn
67- })
68- ]
69- }
70-
71- resource "aws_iam_policy" "imms_s3_kms_policy" {
72- name = " ${ local . short_prefix } -s3-kms-policy"
73- policy = data. aws_iam_policy_document . imms_data_quality_s3_doc . json
74- }
75-
7661module "imms_event_endpoint_lambdas" {
7762 source = " ./modules/lambda"
7863 count = length (local. imms_endpoints )
@@ -89,19 +74,6 @@ module "imms_event_endpoint_lambdas" {
8974 environment = var. environment
9075}
9176
92-
93- # Attach data quality report S3 bucket and KMS policy only to "create_imms" and "update_imms" endpoints
94- resource "aws_iam_role_policy_attachment" "attach_data_quality_s3_to_specific_lambdas" {
95- for_each = {
96- for i , mod in module . imms_event_endpoint_lambdas :
97- local.imms_endpoints[i] => mod
98- if local . imms_endpoints [i ] == " create_imms" || local . imms_endpoints [i ] == " update_imms"
99- }
100-
101- role = each. value . lambda_role_name
102- policy_arn = aws_iam_policy. imms_s3_kms_policy . arn
103- }
104-
10577locals {
10678 # Mapping outputs with each called lambda
10779 imms_lambdas = {
0 commit comments