-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3-hemocione-iac.tf
71 lines (61 loc) · 1.6 KB
/
s3-hemocione-iac.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
resource "aws_s3_bucket" "hemocione-iac" {
bucket = "hemocione-iac"
tags = {
Project = "infrastructre"
Storage = "S3"
"hemocione:data-classification" = "restrict"
}
}
resource "aws_s3_bucket_acl" "hemocione-iac" {
bucket = aws_s3_bucket.hemocione-iac.id
acl = "private"
}
resource "aws_s3_bucket_server_side_encryption_configuration" "hemocione-iac" {
bucket = aws_s3_bucket.hemocione-iac.id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}
resource "aws_s3_bucket_ownership_controls" "hemocione-iac" {
bucket = aws_s3_bucket.hemocione-iac.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}
resource "aws_s3_bucket_public_access_block" "hemocione-iac" {
bucket = aws_s3_bucket.hemocione-iac.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
data "aws_iam_policy_document" "hemocione-iac" {
statement {
sid = "S3ReadWrite"
actions = [
"s3:ListBucket",
"s3:GetObject",
"s3:PutObject",
"s3:DeleteObject",
]
resources = [
aws_s3_bucket.hemocione-iac.arn,
"${aws_s3_bucket.hemocione-iac.arn}/*",
]
principals {
type = "AWS"
identifiers = [
"arn:aws:iam::401973936407:root",
]
}
}
}
resource "aws_s3_bucket_policy" "hemocione-iac" {
bucket = aws_s3_bucket.hemocione-iac.id
policy = data.aws_iam_policy_document.hemocione-iac.json
}
output "hemocione-iac-arn" {
value = aws_s3_bucket.hemocione-iac.arn
}