This repository has been archived by the owner on Mar 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3.tf
90 lines (74 loc) · 2.11 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
87
88
89
90
# Webview bucket
## Customer
resource "aws_s3_bucket" "wv_customer_bucket" {
bucket = "elon-kiosk-webview-customer-bucket"
}
### Bucket ACL setting
resource "aws_s3_bucket_acl" "wv_customer_bucket_acl" {
bucket = aws_s3_bucket.wv_customer_bucket.id
acl = "private"
}
data "aws_iam_policy_document" "wv_customer_bucket_policy" {
statement {
actions = ["s3:GetObject"]
resources = ["${aws_s3_bucket.wv_customer_bucket.arn}/*"]
principals {
type = "AWS"
identifiers = [aws_cloudfront_origin_access_identity.fe_customer_oai.iam_arn]
}
}
}
resource "aws_s3_bucket_policy" "wv_customer_bucket_policy" {
bucket = aws_s3_bucket.wv_customer_bucket.id
policy = data.aws_iam_policy_document.wv_customer_bucket_policy.json
}
## Store
resource "aws_s3_bucket" "wv_store_bucket" {
bucket = "elon-kiosk-webview-store-bucket"
}
### Bucket ACL setting
resource "aws_s3_bucket_acl" "wv_store_bucket_acl" {
bucket = aws_s3_bucket.wv_store_bucket.id
acl = "private"
}
data "aws_iam_policy_document" "wv_store_bucket_policy" {
statement {
actions = ["s3:GetObject"]
resources = ["${aws_s3_bucket.wv_store_bucket.arn}/*"]
principals {
type = "AWS"
identifiers = [aws_cloudfront_origin_access_identity.fe_store_oai.iam_arn]
}
}
}
resource "aws_s3_bucket_policy" "wv_store_bucket_policy" {
bucket = aws_s3_bucket.wv_store_bucket.id
policy = data.aws_iam_policy_document.wv_store_bucket_policy.json
}
# Menu image bucket
resource "aws_s3_bucket" "menu_img_bucket" {
bucket = "elon-kiosk-menu-img-bucket"
}
resource "aws_s3_bucket_policy" "menu_img_bucket_policy" {
bucket = aws_s3_bucket.menu_img_bucket.id
policy = data.aws_iam_policy_document.menu_img_bucket_policy.json
}
data "aws_iam_policy_document" "menu_img_bucket_policy" {
statement {
sid = "AddPerm"
actions = [
"s3:GetObject"
]
resources = [
"${aws_s3_bucket.menu_img_bucket.arn}/*"
]
principals {
type = "*"
identifiers = ["*"]
}
}
}
# Backend bucket
resource "aws_s3_bucket" "be_bucket" {
bucket = "elon-kiosk-backend-bucket"
}