generated from production-ready-toolkit/terraform-module-boilerplate
-
Notifications
You must be signed in to change notification settings - Fork 4
/
cloudwatch.tf
47 lines (42 loc) · 1.23 KB
/
cloudwatch.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
resource "aws_cloudwatch_log_group" "errors" {
name_prefix = format("%s-ES_APPLICATION_LOGS-", var.name)
retention_in_days = var.cloudwatch_rotation
tags = var.tags
}
resource "aws_cloudwatch_log_group" "audit" {
name_prefix = format("%s-AUDIT_LOGS-", var.name)
retention_in_days = var.cloudwatch_rotation
tags = var.tags
}
resource "aws_cloudwatch_log_group" "search" {
name_prefix = format("%s-SEARCH_SLOW_LOGS-", var.name)
retention_in_days = var.cloudwatch_rotation
tags = var.tags
}
resource "aws_cloudwatch_log_group" "index" {
name_prefix = format("%s-INDEX_SLOW_LOGS-", var.name)
retention_in_days = var.cloudwatch_rotation
tags = var.tags
}
resource "aws_cloudwatch_log_resource_policy" "main" {
policy_name = format("%s-es-cluster", var.name)
policy_document = <<CONFIG
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "es.amazonaws.com"
},
"Action": [
"logs:PutLogEvents",
"logs:PutLogEventsBatch",
"logs:CreateLogStream"
],
"Resource": "arn:aws:logs:*"
}
]
}
CONFIG
}