-
Notifications
You must be signed in to change notification settings - Fork 14
/
main.tf
79 lines (68 loc) · 2.5 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
78
79
module "label" {
source = "git::https://github.com/cloudposse/terraform-null-label.git?ref=tags/0.3.3"
namespace = "${var.namespace}"
stage = "${var.stage}"
name = "${var.name}"
delimiter = "${var.delimiter}"
attributes = "${var.attributes}"
tags = "${var.tags}"
}
data "aws_iam_policy_document" "default" {
statement {
sid = "AWSCloudTrailAclCheck"
principals {
type = "Service"
identifiers = ["cloudtrail.amazonaws.com"]
}
actions = [
"s3:GetBucketAcl",
]
resources = [
"arn:aws:s3:::${module.label.id}",
]
}
statement {
sid = "AWSCloudTrailWrite"
principals {
type = "Service"
identifiers = ["config.amazonaws.com", "cloudtrail.amazonaws.com"]
}
actions = [
"s3:PutObject",
]
resources = [
"arn:aws:s3:::${module.label.id}/*",
]
condition {
test = "StringEquals"
variable = "s3:x-amz-acl"
values = [
"bucket-owner-full-control",
]
}
}
}
module "s3_bucket" {
source = "git::https://github.com/cloudposse/terraform-aws-s3-log-storage.git?ref=tags/0.4.0"
namespace = "${var.namespace}"
stage = "${var.stage}"
name = "${var.name}"
region = "${var.region}"
acl = "${var.acl}"
policy = "${data.aws_iam_policy_document.default.json}"
force_destroy = "${var.force_destroy}"
versioning_enabled = "${var.versioning_enabled}"
lifecycle_rule_enabled = "${var.lifecycle_rule_enabled}"
lifecycle_prefix = "${var.lifecycle_prefix}"
lifecycle_tags = "${var.lifecycle_tags}"
noncurrent_version_expiration_days = "${var.noncurrent_version_expiration_days}"
noncurrent_version_transition_days = "${var.noncurrent_version_transition_days}"
standard_transition_days = "${var.standard_transition_days}"
glacier_transition_days = "${var.glacier_transition_days}"
expiration_days = "${var.expiration_days}"
sse_algorithm = "${var.sse_algorithm}"
kms_master_key_id = "${var.kms_master_key_id}"
delimiter = "${var.delimiter}"
attributes = "${var.attributes}"
tags = "${var.tags}"
}