Skip to content

Commit

Permalink
feat(terraform): add if statement to scheduled jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
matbeales committed Aug 2, 2024
1 parent 0594180 commit 547b5dd
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions infra/terraform/modules/service/batch.tf
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,12 @@ locals {
retry_strategy = local.default_retry_policy
} }

schedules = { for job in var.batch.jobs : job.name => {
if job.schedule != "" {
description = "Schedule for ${job.name}"
schedule_expression = job.schedule
arn = "arn:aws:scheduler:::aws-sdk:batch:submitJob"
input = jsonencode({ "jobName" : "${job.name}", "jobQueue" : "vol-app-${var.environment}-default", "jobDefinition" : "arn:aws:batch:eu-west-1:054614622558:job-definition/${job.name}"})
}
} }
schedules = { for job in var.batch.jobs : job.name => (job.schedule != "" ? {
description = "Schedule for ${job.name}"
schedule_expression = job.schedule
arn = "arn:aws:scheduler:::aws-sdk:batch:submitJob"
input = jsonencode({ "jobName" : "${job.name}", "jobQueue" : "vol-app-${var.environment}-default", "jobDefinition" : "arn:aws:batch:eu-west-1:054614622558:job-definition/${job.name}"})
} : null) }
}

module "batch" {
Expand Down

0 comments on commit 547b5dd

Please sign in to comment.