forked from dsaidgovsg/terraform-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
/
slow_index.tf
30 lines (24 loc) · 884 Bytes
/
slow_index.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
resource "aws_cloudwatch_log_group" "es_slow_index_log" {
count = "${var.enable_slow_index_log ? 1 : 0}"
name = "${var.slow_index_log_name}"
retention_in_days = "${var.slow_index_log_retention}"
tags = "${merge(var.slow_index_additional_tags, map("Name", format("%s", var.slow_index_log_name)))}"
}
data "aws_iam_policy_document" "es_slow_index_log" {
statement {
actions = [
"logs:PutLogEvents",
"logs:CreateLogStream",
]
resources = ["${local.cloudwatch_log_group_arn}"]
principals {
type = "Service"
identifiers = ["es.amazonaws.com"]
}
}
}
resource "aws_cloudwatch_log_resource_policy" "es_slow_index_log" {
count = "${var.enable_slow_index_log ? 1 : 0}"
policy_document = "${data.aws_iam_policy_document.es_slow_index_log.json}"
policy_name = "${var.slow_index_log_name}"
}