-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMain.tf
More file actions
32 lines (25 loc) · 674 Bytes
/
Main.tf
File metadata and controls
32 lines (25 loc) · 674 Bytes
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
resource "aws_s3_bucket" "b" {
bucket = "terror-mw"
acl = "private"
}
resource "aws_s3_bucket_public_access_block" "blocks" {
bucket = aws_s3_bucket.b.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
data "aws_iam_policy_document" "m" {
statement {
actions = ["s3:GetObject"]
resources = ["${aws_s3_bucket.b.arn}/*"]
principals {
type = "AWS"
identifiers = [aws_cloudfront_origin_access_identity.m.iam_arn]
}
}
}
resource "aws_s3_bucket_policy" "m" {
bucket = aws_s3_bucket.b.id
policy = data.aws_iam_policy_document.m.json
}