-
Notifications
You must be signed in to change notification settings - Fork 0
/
bucket_originals_video_backup.tf
58 lines (49 loc) · 1.47 KB
/
bucket_originals_video_backup.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
resource "aws_s3_bucket" "originals_video_backup" {
count = terraform.workspace == "production" ? 1 : 0
provider = aws.backup
bucket = "${local.name_prefix}-originals-video-backup"
tags = {
"service" = "kithe"
"use" = "originals"
"S3-Bucket-Name" = "${local.name_prefix}-originals-video-backup"
}
}
resource "aws_s3_bucket_lifecycle_configuration" "originals_video_backup" {
count = terraform.workspace == "production" ? 1 : 0
bucket = aws_s3_bucket.originals_video_backup[0].id
provider = aws.backup
rule {
status = "Enabled"
id = "Expire previous files"
noncurrent_version_expiration {
noncurrent_days = 30
}
}
rule {
status = "Enabled"
id = "${local.name_prefix}-originals-video-backup_Lifecycle"
transition {
days = 30
storage_class = "STANDARD_IA"
}
}
}
resource "aws_s3_bucket_versioning" "originals_video_backup" {
count = terraform.workspace == "production" ? 1 : 0
bucket = aws_s3_bucket.originals_video_backup[0].id
provider = aws.backup
versioning_configuration {
status = "Enabled"
}
}
resource "aws_s3_bucket_server_side_encryption_configuration" "originals_video_backup" {
count = terraform.workspace == "production" ? 1 : 0
bucket = aws_s3_bucket.originals_video_backup[0].id
provider = aws.backup
rule {
bucket_key_enabled = false
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}