-
Notifications
You must be signed in to change notification settings - Fork 9
/
s3_cache.tf
39 lines (29 loc) · 1.09 KB
/
s3_cache.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
#############################################################
# S3 Buckets
#############################################################
module "s3_cache_bucket" {
enabled = var.enable_s3_cache
source = "cloudposse/s3-bucket/aws"
version = "0.33.0"
context = module.default_label.context
attributes = compact(concat(var.attributes, ["cache"]))
user_enabled = false
versioning_enabled = false
force_destroy = true
enable_glacier_transition = false
expiration_days = var.s3_cache_expiration
standard_transition_days = var.s3_cache_infrequent_access_transition
lifecycle_rule_enabled = true
}
#############################################################
# S3 Bucket public access
#############################################################
resource "aws_s3_bucket_public_access_block" "cache" {
count = var.enable_s3_cache ? 1 : 0
depends_on = [module.s3_cache_bucket]
bucket = module.s3_cache_bucket.bucket_id
block_public_acls = true
block_public_policy = true
ignore_public_acls = true
restrict_public_buckets = true
}