-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmodule_s3bucket_pii_data.tf
More file actions
82 lines (64 loc) · 1.55 KB
/
module_s3bucket_pii_data.tf
File metadata and controls
82 lines (64 loc) · 1.55 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
module "s3bucket_pii_data" {
source = "https://github.com/NHSDigital/nhs-notify-shared-modules/releases/download/3.0.6/terraform-s3bucket.zip"
name = "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_pii_data.json]
force_destroy = var.force_destroy
lifecycle_rules = [
{
enabled = true
expiration = {
days = var.pii_data_retention_policy_days
}
noncurrent_version_expiration = {
noncurrent_days = var.pii_data_retention_non_current_days
}
abort_incomplete_multipart_upload = {
days = "1"
}
}
]
default_tags = {
NHSE-Enable-S3-Backup-Acct = "True"
}
}
data "aws_iam_policy_document" "s3bucket_pii_data" {
statement {
sid = "AllowManagedAccountsToList"
effect = "Allow"
actions = [
"s3:ListBucket",
]
resources = [
module.s3bucket_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_pii_data.arn}/*",
]
principals {
type = "AWS"
identifiers = [
"arn:aws:iam::${var.aws_account_id}:root"
]
}
}
}