-
Notifications
You must be signed in to change notification settings - Fork 0
/
bucket_public.tf
39 lines (33 loc) · 946 Bytes
/
bucket_public.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
#
# A public bucket intended for a variety of uses. Does not have versioning turned on at present.
#
resource "aws_s3_bucket" "public" {
bucket = "${local.name_prefix}-public"
lifecycle {
prevent_destroy = true
}
tags = {
"service" = local.service_tag
"use" = "general_public"
"S3-Bucket-Name" = "${local.name_prefix}-public"
}
}
resource "aws_s3_bucket_versioning" "public" {
bucket = aws_s3_bucket.public.id
versioning_configuration {
status = "Disabled"
}
}
resource "aws_s3_bucket_policy" "public" {
bucket = aws_s3_bucket.public.id
policy = templatefile("templates/s3_public_read_policy.tftpl", { bucket_name : aws_s3_bucket.public.id })
}
resource "aws_s3_bucket_server_side_encryption_configuration" "public" {
bucket = aws_s3_bucket.public.id
rule {
bucket_key_enabled = false
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}