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}
@@ -57,20 +56,6 @@ data "aws_iam_policy_document" "imms_policy_document" {
5756 ]
5857}
5958
60- data "aws_iam_policy_document" "imms_data_quality_s3_doc" {
61- source_policy_documents = [
62- templatefile (" ${ local . policy_path } /s3_data_quality_access.json" , {
63- s3_bucket_arn = aws_s3_bucket.data_quality_reports_bucket.arn
64- kms_key_arn = data.aws_kms_key.existing_s3_encryption_key.arn
65- })
66- ]
67- }
68-
69- resource "aws_iam_policy" "imms_s3_kms_policy" {
70- name = " ${ local . short_prefix } -s3-kms-policy"
71- policy = data. aws_iam_policy_document . imms_data_quality_s3_doc . json
72- }
73-
7459module "imms_event_endpoint_lambdas" {
7560 source = " ./modules/lambda"
7661 count = length (local. imms_endpoints )
@@ -85,19 +70,6 @@ module "imms_event_endpoint_lambdas" {
8570 vpc_security_group_ids = [data . aws_security_group . existing_securitygroup . id ]
8671}
8772
88-
89- # Attach data quality report S3 bucket and KMS policy only to "create_imms" and "update_imms" endpoints
90- resource "aws_iam_role_policy_attachment" "attach_data_quality_s3_to_specific_lambdas" {
91- for_each = {
92- for i , mod in module . imms_event_endpoint_lambdas :
93- local.imms_endpoints[i] => mod
94- if local . imms_endpoints [i ] == " create_imms" || local . imms_endpoints [i ] == " update_imms"
95- }
96-
97- role = each. value . lambda_role_name
98- policy_arn = aws_iam_policy. imms_s3_kms_policy . arn
99- }
100-
10173locals {
10274 # Mapping outputs with each called lambda
10375 imms_lambdas = {
0 commit comments