Skip to content

Commit 38f640d

Browse files
CCM-8861: Create all events
1 parent 7ecc702 commit 38f640d

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

infrastructure/terraform/modules/backend-api/cloudwatch_event_rule_sftp_poll.tf

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11
resource "aws_cloudwatch_event_rule" "sftp_poll" {
2-
for_each = { for k, v in var.letter_suppliers : k => v if v.polling_enabled }
2+
for_each = var.letter_suppliers
33

44
name = "${local.csi}-sftp-poll-${lower(each.key)}"
55
schedule_expression = "rate(1 hour)" # Runs at the top of every hour
6+
7+
state = each.value.polling_enabled ? "ENABLED" : "DISABLED"
68
}
79

810
resource "aws_cloudwatch_event_target" "sftp_poll" {
9-
for_each = { for k, v in var.letter_suppliers : k => v if v.polling_enabled }
11+
for_each = var.letter_suppliers
1012
rule = aws_cloudwatch_event_rule.sftp_poll[each.key].name
1113
arn = module.lambda_sftp_poll.function_arn
1214

@@ -16,7 +18,7 @@ resource "aws_cloudwatch_event_target" "sftp_poll" {
1618
}
1719

1820
resource "aws_lambda_permission" "allow_cloudwatch" {
19-
for_each = { for k, v in var.letter_suppliers : k => v if v.polling_enabled }
21+
for_each = var.letter_suppliers
2022
statement_id = "AllowExecutionFromCloudWatch${each.key}"
2123
action = "lambda:InvokeFunction"
2224
function_name = module.lambda_sftp_poll.function_name

0 commit comments

Comments
 (0)