-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy paths3.tf
More file actions
61 lines (50 loc) · 1.47 KB
/
s3.tf
File metadata and controls
61 lines (50 loc) · 1.47 KB
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
# Additional provider configuration for region your controlshift platform lives within.
provider "aws" {
alias = "controlshift"
region = var.controlshift_aws_region
}
resource "aws_s3_bucket" "manifest" {
provider = aws.controlshift
bucket = var.manifest_bucket_name
tags = {
Name = "ControlShift puts import manifests here"
}
}
# Ownership controls block is required to support ACLs.
resource "aws_s3_bucket_ownership_controls" "manifest" {
provider = aws.controlshift
bucket = aws_s3_bucket.manifest.id
rule {
object_ownership = "ObjectWriter"
}
}
resource "aws_s3_bucket_lifecycle_configuration" "manifest" {
provider = aws.controlshift
bucket = aws_s3_bucket.manifest.id
# expire the ingested manifests after 5 days after they have been processed to save disk space while providing enough
# time to analyze things that might have gone wrong.
rule {
id = "expire-manifests"
status = "Enabled"
expiration {
days = 5
}
# Best practice: filter is now required inside the rule block
filter {}
}
}
resource "aws_s3_bucket_acl" "manifest" {
provider = aws.controlshift
depends_on = [aws_s3_bucket_ownership_controls.manifest]
bucket = aws_s3_bucket.manifest.id
acl = "private"
}
resource "aws_s3_bucket_server_side_encryption_configuration" "manifest" {
provider = aws.controlshift
bucket = aws_s3_bucket.manifest.id
rule {
apply_server_side_encryption_by_default {
sse_algorithm = "AES256"
}
}
}