Skip to content

Commit

Permalink
feature #3 - add rule to scheduled job
Browse files Browse the repository at this point in the history
  • Loading branch information
Eugeniosales committed Oct 17, 2022
1 parent 83c0705 commit 5c0e6bb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
3 changes: 3 additions & 0 deletions terraform/event-bridge.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resource "aws_cloudwatch_event_bus" "exchange_rate_bus" {
name = "exchange-rate-bus"
}
6 changes: 6 additions & 0 deletions terraform/event-rule.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
resource "aws_cloudwatch_event_rule" "update_exchange_rate_rule" {
name = "update-exchange-rate-rule"
event_bus_name = aws_cloudwatch_event_bus.exchange_rate_bus.name
description = "update exchange rate rule"
schedule_expression = "rate(1 minute)" # Could be replaced to 1 minute or less
}
5 changes: 5 additions & 0 deletions terraform/event-target.tf
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
resource "aws_cloudwatch_event_target" "update_exchange_rate_sqs_target" {
arn = aws_sqs_queue.update-exchange-rate-queue.arn
event_bus_name = aws_cloudwatch_event_bus.exchange_rate_bus.name
rule = aws_cloudwatch_event_rule.update_exchange_rate_rule.name
}

0 comments on commit 5c0e6bb

Please sign in to comment.