-
Notifications
You must be signed in to change notification settings - Fork 41
/
main.tf
77 lines (59 loc) · 1.92 KB
/
main.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
# ---------------------------------------------------------------------------------------------------------------------
# CREATE TWO SECURE S3 BUCKETS INSIDE THE SAME AWS ACCOUNT
# This example creates a S3 Bucket and another Log S3 Bucket.
# ---------------------------------------------------------------------------------------------------------------------
provider "aws" {
region = "us-east-1"
}
# ---------------------------------------------------------------------------------------------------------------------
# Create the Example App S3 Bucket
# ---------------------------------------------------------------------------------------------------------------------
module "example-app-bucket" {
source = "mineiros-io/s3-bucket/aws"
version = "~> 0.6.0"
bucket_prefix = "app"
access_points = [{ name = "app" }]
versioning = true
logging = {
target_bucket = module.example-log-bucket.id
target_prefix = "log/app/"
}
tags = {
Name = "SPA S3 Bucket"
}
}
# ---------------------------------------------------------------------------------------------------------------------
# Create the Example Log S3 Bucket
# ---------------------------------------------------------------------------------------------------------------------
module "example-log-bucket" {
source = "mineiros-io/s3-bucket/aws"
version = "~> 0.6.0"
bucket_prefix = "log"
acl = "log-delivery-write"
# allow elb log delivery from multiple regions
elb_regions = ["us-east-1", "eu-west-1"]
lifecycle_rules = [
{
id = "log"
enabled = true
prefix = "log/"
tags = {
"rule" = "log"
"autoclean" = "true"
}
transition = [
{
days = 30
storage_class = "STANDARD_IA"
},
{
days = 60
storage_class = "GLACIER"
}
]
expiration = {
days = 90
}
}
]
}