-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathui.tf
42 lines (32 loc) · 922 Bytes
/
ui.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
resource "aws_s3_bucket" "ui" {
bucket = "ui-app-bucket"
}
resource "aws_s3_bucket_public_access_block" "allow_access_to_ui" {
bucket = aws_s3_bucket.ui.id
block_public_acls = false
block_public_policy = false
ignore_public_acls = false
restrict_public_buckets = false
}
resource "aws_s3_bucket_website_configuration" "ui" {
bucket = aws_s3_bucket.ui.id
index_document {
suffix = "index.html"
}
error_document {
key = "index.html"
}
}
resource "aws_s3_bucket_policy" "allow_access_to_ui" {
bucket = aws_s3_bucket.ui.id
policy = jsonencode({
Version = "2012-10-17"
Statement = [{
Principal = "*"
Effect = "Allow"
Action = ["s3:GetObject"]
Resource = ["arn:aws:s3:::ui-app-bucket/*"]
}]
})
depends_on = [aws_s3_bucket.ui, aws_s3_bucket_public_access_block.allow_access_to_ui, aws_s3_bucket_website_configuration.ui]
}