File tree Expand file tree Collapse file tree 2 files changed +34
-0
lines changed
terraform/modules/department Expand file tree Collapse file tree 2 files changed +34
-0
lines changed Original file line number Diff line number Diff line change @@ -979,3 +979,31 @@ data "aws_iam_policy_document" "ecs_assume_role_policy" {
979979 actions = [" sts:AssumeRole" ]
980980 }
981981}
982+
983+ // s3 access for mtfh data in landing zone
984+ data "aws_iam_policy_document" "mtfh_access" {
985+ count = local. department_identifier == " data-and-insight" ? 1 : 0
986+
987+ statement {
988+ sid = " S3ReadMtfhDirectory"
989+ effect = " Allow"
990+ actions = [
991+ " s3:GetObject" ,
992+ " s3:GetObjectVersion" ,
993+ " s3:ListBucket" ,
994+ ]
995+ resources = [
996+ " ${ var . landing_zone_bucket . bucket_arn } /mtfh/*" ,
997+ var . landing_zone_bucket . bucket_arn
998+ ]
999+ }
1000+ }
1001+
1002+ resource "aws_iam_policy" "mtfh_access_policy" {
1003+ count = local. department_identifier == " data-and-insight" ? 1 : 0
1004+ name = lower (" ${ var . identifier_prefix } -${ local . department_identifier } -mtfh-landing-access-policy" )
1005+ description = " Allows data-and-insight department access for ecs tasks to mtfh/ subdirectory in landing zone"
1006+ policy = data. aws_iam_policy_document . mtfh_access [0 ]. json
1007+ }
1008+
1009+
Original file line number Diff line number Diff line change @@ -162,3 +162,9 @@ resource "aws_iam_role_policy" "grant_s3_access_to_ecs_role" {
162162 role = aws_iam_role. department_ecs_role . name
163163 policy = data. aws_iam_policy_document . s3_department_access . json
164164}
165+
166+ resource "aws_iam_role_policy_attachment" "mtfh_access_attachment" {
167+ count = local. department_identifier == " data-and-insight" ? 1 : 0
168+ role = aws_iam_role. department_ecs_role . name
169+ policy_arn = aws_iam_policy. mtfh_access_policy [0 ]. arn
170+ }
You can’t perform that action at this time.
0 commit comments