-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbucket.tf
41 lines (34 loc) · 960 Bytes
/
bucket.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" "buckets3" {
bucket_prefix = var.bucket_prefix
force_destroy = true
tags = {
Name = "S3-bucket-images"
}
}
resource "aws_s3_bucket_lifecycle_configuration" "my_lifecycle_configuration" {
bucket = aws_s3_bucket.buckets3.id
rule {
id = "image"
transition {
days = var.days
storage_class = var.storage_class
}
status = "Enabled"
}
}
resource "aws_s3_bucket_server_side_encryption_configuration" "encryption_resource" {
bucket = aws_s3_bucket.buckets3.id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = var.sse_algorithm
}
}
}
resource "aws_s3_bucket_public_access_block" "blocking_public_access" {
bucket = aws_s3_bucket.buckets3.id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}
# aws s3 rm s3://s3-csye-6225-product-image --recursive --profile dev