-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paths3.tf
35 lines (30 loc) · 837 Bytes
/
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
resource "aws_s3_bucket" "text_to_image" {
bucket = "text-to-image-bucket-${random_string.bucket_suffix.result}"
}
resource "random_string" "bucket_suffix" {
length = 8
special = false
upper = false
}
resource "aws_s3_bucket_public_access_block" "text_to_image" {
bucket = aws_s3_bucket.text_to_image.id
block_public_acls = false
block_public_policy = false
ignore_public_acls = false
restrict_public_buckets = false
}
resource "aws_s3_bucket_policy" "text_to_image" {
bucket = aws_s3_bucket.text_to_image.id
policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Sid = "PublicReadGetObject"
Effect = "Allow"
Principal = "*"
Action = "s3:GetObject"
Resource = "${aws_s3_bucket.text_to_image.arn}/*"
}
]
})
}