Skip to content

Commit 86546af

Browse files
authored
feat: Add create_scheduling_policy option to job_queue (#3)
1 parent b0b3857 commit 86546af

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ resource "aws_batch_job_queue" "this" {
223223
name = each.value.name
224224
state = each.value.state
225225
priority = each.value.priority
226-
scheduling_policy_arn = try(each.value.scheduling_policy_arn, aws_batch_scheduling_policy.this[each.key].arn)
226+
scheduling_policy_arn = try(each.value.create_scheduling_policy, true) ? aws_batch_scheduling_policy.this[each.key].arn : try(each.value.scheduling_policy_arn, null)
227227
compute_environments = [for env in aws_batch_compute_environment.this : env.arn]
228228

229229
tags = merge(var.tags, lookup(each.value, "tags", {}))
@@ -234,7 +234,7 @@ resource "aws_batch_job_queue" "this" {
234234
################################################################################
235235

236236
resource "aws_batch_scheduling_policy" "this" {
237-
for_each = { for k, v in var.job_queues : k => v if var.create && var.create_job_queues }
237+
for_each = { for k, v in var.job_queues : k => v if var.create && var.create_job_queues && try(v.create_scheduling_policy, true) }
238238

239239
name = each.value.name
240240

0 commit comments

Comments
 (0)