Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions prod-eu-west/services/events/input.tf
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,7 @@ data "aws_lb_listener" "default" {
load_balancer_arn = data.aws_lb.default.arn
port = 443
}

data "aws_iam_role" "ecs_events" {
name = "ecs_events"
}
33 changes: 33 additions & 0 deletions prod-eu-west/services/events/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,36 @@ resource "aws_route53_record" "split-events" {
ttl = var.ttl
records = [data.aws_lb.default.dns_name]
}

resource "aws_cloudwatch_event_rule" "events-reindex-touched-dois" {
name = "events-reindex-touched-dois"
schedule_expression = "cron(0 12 * * ? *)"
}

resource "aws_cloudwatch_event_target" "events-reindex-touched-dois" {
target_id = "events-reindex-touched-dois"
arn = data.aws_ecs_cluster.default.arn
rule = aws_cloudwatch_event_rule.events-reindex-touched-dois.name
role_arn = data.aws_iam_role.ecs_events.arn

input = jsonencode({
containerOverrides = [{
name = "events"
command = ["bundle", "exec", "rake", "event:reindex_touched_dois"]
}]
})

ecs_target {
task_count = 1
launch_type = "FARGATE"
task_definition_arn = aws_ecs_task_definition.events.arn

network_configuration {
security_groups = [data.aws_security_group.datacite-private.id]
subnets = [
data.aws_subnet.datacite-private.id,
data.aws_subnet.datacite-alt.id
]
}
}
}