From 1397061cc354af3e674d49ccd012951a8b37ac9e Mon Sep 17 00:00:00 2001 From: matt <97546619+mattaltberg@users.noreply.github.com> Date: Mon, 4 Jul 2022 11:00:38 -0400 Subject: [PATCH] Add create_scheduling_policy option to job_queue With this, someone can use attach_scheduling_policy in their job_queue definition to skip over scheduling policy attachment. --- main.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/main.tf b/main.tf index 525aa52..340d6ac 100644 --- a/main.tf +++ b/main.tf @@ -223,7 +223,7 @@ resource "aws_batch_job_queue" "this" { name = each.value.name state = each.value.state priority = each.value.priority - scheduling_policy_arn = try(each.value.scheduling_policy_arn, aws_batch_scheduling_policy.this[each.key].arn) + 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) compute_environments = [for env in aws_batch_compute_environment.this : env.arn] tags = merge(var.tags, lookup(each.value, "tags", {})) @@ -234,7 +234,7 @@ resource "aws_batch_job_queue" "this" { ################################################################################ resource "aws_batch_scheduling_policy" "this" { - for_each = { for k, v in var.job_queues : k => v if var.create && var.create_job_queues } + for_each = { for k, v in var.job_queues : k => v if var.create && var.create_job_queues && try(v.create_scheduling_policy, true) } name = each.value.name