forked from guyeisenkot/supplygoat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
94 lines (87 loc) · 2.35 KB
/
main.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
87
88
89
90
91
92
93
94
resource "aws_s3_bucket" "data" {
# bucket is public
# bucket is not encrypted
# bucket does not have access logs
# bucket does not have versioning
bucket = "${local.resource_prefix.value}-data"
region = "us-west-2"
acl = "public-read"
force_destroy = true
tags = {
Name = "${local.resource_prefix.value}-data"
Environment = local.resource_prefix.value
}
}
resource "aws_s3_bucket_object" "data_object" {
bucket = aws_s3_bucket.data.id
region = "us-west-2"
key = "customer-master.xlsx"
source = "resources/customer-master.xlsx"
tags = {
Name = "${local.resource_prefix.value}-customer-master"
Environment = local.resource_prefix.value
}
}
resource "aws_s3_bucket" "financials" {
# bucket is not encrypted
# bucket does not have access logs
# bucket does not have versioning
bucket = "${local.resource_prefix.value}-financials"
region = "us-west-2"
acl = "private"
force_destroy = true
tags = {
Name = "${local.resource_prefix.value}-financials"
Environment = local.resource_prefix.value
}
}
resource "aws_s3_bucket" "operations" {
# bucket is not encrypted
# bucket does not have access logs
bucket = "${local.resource_prefix.value}-operations"
region = "us-west-2"
acl = "private"
versioning {
enabled = true
}
force_destroy = true
tags = {
Name = "${local.resource_prefix.value}-operations"
Environment = local.resource_prefix.value
}
}
resource "aws_s3_bucket" "data_science" {
# bucket is not encrypted
bucket = "${local.resource_prefix.value}-data-science"
region = "us-west-2"
acl = "private"
versioning {
enabled = true
}
logging {
target_bucket = "${aws_s3_bucket.logs.id}"
target_prefix = "log/"
}
force_destroy = true
}
resource "aws_s3_bucket" "logs" {
bucket = "${local.resource_prefix.value}-logs"
region = "us-west-2"
acl = "log-delivery-write"
versioning {
enabled = true
}
server_side_encryption_configuration {
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "aws:kms"
kms_master_key_id = "${aws_kms_key.logs_key.arn}"
}
}
}
force_destroy = true
tags = {
Name = "${local.resource_prefix.value}-logs"
Environment = local.resource_prefix.value
}
}