forked from aehrc/terraform-aws-serverless-beacon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
s3.tf
115 lines (93 loc) · 2.48 KB
/
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
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#
# S3 bucket for persisted vcf summaries and variant queries
#
resource "aws_s3_bucket" "variants-bucket" {
bucket_prefix = var.variants-bucket-prefix
force_destroy = true
tags = var.common-tags
}
resource "aws_s3_bucket_ownership_controls" "variants_bucket_ownership_controls" {
bucket = aws_s3_bucket.variants-bucket.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}
resource "aws_s3_bucket_acl" "variants_bucket_acl" {
depends_on = [aws_s3_bucket_ownership_controls.variants_bucket_ownership_controls]
bucket = aws_s3_bucket.variants-bucket.id
acl = "private"
}
resource "aws_s3_bucket_lifecycle_configuration" "variants_bucket_lifecycle" {
bucket = aws_s3_bucket.variants-bucket.id
rule {
id = "clean-old-queries"
status = "Enabled"
filter {
prefix = "variant-queries/"
}
expiration {
days = 1
}
}
}
#
# S3 bucket for metadata handling
#
resource "aws_s3_bucket" "metadata-bucket" {
bucket_prefix = var.metadata-bucket-prefix
force_destroy = true
tags = var.common-tags
}
resource "aws_s3_bucket_ownership_controls" "metadata_bucket_ownership_controls" {
bucket = aws_s3_bucket.metadata-bucket.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}
resource "aws_s3_bucket_acl" "metadata" {
depends_on = [aws_s3_bucket_ownership_controls.metadata_bucket_ownership_controls]
bucket = aws_s3_bucket.metadata-bucket.id
acl = "private"
}
resource "aws_s3_bucket_lifecycle_configuration" "metadata_bucket_lifecycle" {
bucket = aws_s3_bucket.metadata-bucket.id
rule {
id = "clean-old-query-results"
status = "Enabled"
filter {
prefix = "query-results/"
}
expiration {
days = 2
}
}
rule {
id = "clean-old-cached-results"
status = "Enabled"
filter {
prefix = "query-responses/"
}
expiration {
days = 2
}
}
}
#
# S3 bucket for lambda layers
#
resource "aws_s3_bucket" "lambda-layers-bucket" {
bucket_prefix = var.lambda-layers-bucket-prefix
force_destroy = true
tags = var.common-tags
}
resource "aws_s3_bucket_ownership_controls" "lambda_layers_bucket_ownership_controls" {
bucket = aws_s3_bucket.lambda-layers-bucket.id
rule {
object_ownership = "BucketOwnerPreferred"
}
}
resource "aws_s3_bucket_acl" "lambda-layers" {
depends_on = [aws_s3_bucket_ownership_controls.lambda_layers_bucket_ownership_controls]
bucket = aws_s3_bucket.lambda-layers-bucket.id
acl = "private"
}