-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3.tf
86 lines (69 loc) · 2.36 KB
/
s3.tf
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
83
84
85
86
module "s3_bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
bucket = format(module.naming.result, "web-bucket")
force_destroy = false
control_object_ownership = true
object_ownership = "ObjectWriter"
acl = "private"
# S3 bucket-level Public Access Block configuration (by default now AWS has made this default as true for S3 bucket-level block public access)
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
versioning = {
enabled = true
}
attach_policy = true
policy = templatefile(
"./files/static-web-bucket-policy.tftpl",
{
s3_bucket_arn = "arn:aws:s3:::${format(module.naming.result, "web-bucket")}"
}
)
}
module "s3_backend_application_bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
bucket = format(module.naming.result, "backend-bucket")
force_destroy = true
control_object_ownership = true
object_ownership = "ObjectWriter"
acl = "private"
# S3 bucket-level Public Access Block configuration (by default now AWS has made this default as true for S3 bucket-level block public access)
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
versioning = {
enabled = true
}
attach_policy = true
policy = templatefile(
"./files/backend-bucket-policy.tftpl",
{
s3_bucket_arn = "arn:aws:s3:::${format(module.naming.result, "backend-bucket")}"
}
)
}
module "s3_noti_application_bucket" {
source = "terraform-aws-modules/s3-bucket/aws"
bucket = format(module.naming.result, "noti-bucket")
force_destroy = true
control_object_ownership = true
object_ownership = "ObjectWriter"
acl = "private"
# S3 bucket-level Public Access Block configuration (by default now AWS has made this default as true for S3 bucket-level block public access)
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
versioning = {
enabled = true
}
attach_policy = true
policy = templatefile(
"./files/backend-bucket-policy.tftpl",
{
s3_bucket_arn = "arn:aws:s3:::${format(module.naming.result, "noti-bucket")}"
}
)
}