Skip to content

Commit 25f1725

Browse files
authored
feat: add custom GetObject permission for CRA ReadOnly role (#380)
* feat: add custom GetObject permission for CRA ReadOnly role * chore: fmt
1 parent 8b4ddfd commit 25f1725

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

terragrunt/org_account/iam_identity_center/digital_transformation_office_assignments.tf

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ locals {
4343
group = aws_identitystore_group.cra_dashboard_staging_read_only,
4444
permission_set = data.aws_ssoadmin_permission_set.aws_read_only_access,
4545
},
46+
{
47+
group = aws_identitystore_group.cra_dashboard_staging_read_only,
48+
permission_set = aws_ssoadmin_permission_set.cra_bucket_get_object,
49+
}
4650
]
4751
}
4852

@@ -83,4 +87,4 @@ resource "aws_ssoadmin_account_assignment" "cra_dashboard_staging" {
8387

8488
target_id = local.cra_dashboard_staging_account_id
8589
target_type = "AWS_ACCOUNT"
86-
}
90+
}
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
#
2+
# CRA Bucket GetObject Permissions
3+
#
4+
5+
resource "aws_ssoadmin_permission_set" "cra_bucket_get_object" {
6+
name = "CRABucket-GetObject"
7+
description = "Grants read-only access to the CRA S3 bucket."
8+
instance_arn = local.sso_instance_arn
9+
}
10+
11+
12+
resource "aws_ssoadmin_permission_set_inline_policy" "cra_bucket_get_object" {
13+
permission_set_arn = aws_ssoadmin_permission_set.cra_bucket_get_object.arn
14+
inline_policy = data.aws_iam_policy_document.cra_bucket_get_object.json
15+
instance_arn = local.sso_instance_arn
16+
}
17+
18+
19+
data "aws_iam_policy_document" "cra_bucket_get_object" {
20+
statement {
21+
sid = "AllowDataBucketReadAccess"
22+
effect = "Allow"
23+
actions = [
24+
"s3:ListBucket",
25+
"s3:GetObject",
26+
"s3:GetObjectAcl"
27+
]
28+
resources = [
29+
"arn:aws:s3:::cra-upd-dashboard-data-staging/*",
30+
"arn:aws:s3:::cra-upd-dashboard-data-staging"
31+
]
32+
}
33+
}

0 commit comments

Comments
 (0)