-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.tf
33 lines (24 loc) · 1 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
resource "aws_cloudwatch_event_rule" "main" {
count = var.create ? 1 : 0
name = var.name
description = var.description
schedule_expression = var.schedule
role_arn = var.role_arn
is_enabled = var.is_enabled
tags = var.default_tags
event_pattern = var.event_pattern
}
resource "aws_cloudwatch_event_target" "main" {
count = var.create ? length(var.targets) : 0
rule = aws_cloudwatch_event_rule.main.0.name
arn = lookup(var.targets[count.index], "arn", null)
target_id = lookup(var.targets[count.index], "target_id", null)
dynamic "input_transformer" {
for_each = lookup(var.targets[count.index], "input_transformer", [])
content {
input_paths = lookup(input_transformer.value, "input_paths", null )
input_template = lookup(input_transformer.value, "input_template", null)
}
}
depends_on = [ aws_cloudwatch_event_rule.main, var.depends_modules ]
}