-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathmodule_s3bucket_non_pii_data.tf
More file actions
58 lines (46 loc) · 1.15 KB
/
module_s3bucket_non_pii_data.tf
File metadata and controls
58 lines (46 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
module "s3bucket_non_pii_data" {
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/v2.0.24/terraform-s3bucket.zip"
name = "non-pii-data"
aws_account_id = var.aws_account_id
region = var.region
project = var.project
environment = var.environment
component = local.component
kms_key_arn = module.kms.key_arn
policy_documents = [data.aws_iam_policy_document.s3bucket_non_pii_data.json]
}
data "aws_iam_policy_document" "s3bucket_non_pii_data" {
statement {
sid = "AllowManagedAccountsToList"
effect = "Allow"
actions = [
"s3:ListBucket",
]
resources = [
module.s3bucket_non_pii_data.arn,
]
principals {
type = "AWS"
identifiers = [
"arn:aws:iam::${var.aws_account_id}:root"
]
}
}
statement {
sid = "AllowManagedAccountsToGet"
effect = "Allow"
actions = [
"s3:GetObject",
"s3:PutObject",
]
resources = [
"${module.s3bucket_non_pii_data.arn}/*",
]
principals {
type = "AWS"
identifiers = [
"arn:aws:iam::${var.aws_account_id}:root"
]
}
}
}