Skip to content

Commit

Permalink
fix: Karpenter enable_spot_termination = false should not result in…
Browse files Browse the repository at this point in the history
… an error (#2907)

* Add condition for statement if enable_spot_termination is true

* Update modules/karpenter/main.tf

---------

Co-authored-by: Bryant Biggs <bryantbiggs@gmail.com>
  • Loading branch information
nikoshet and bryantbiggs authored Feb 8, 2024
1 parent a9212a4 commit 671fc6e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions modules/karpenter/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -252,15 +252,19 @@ data "aws_iam_policy_document" "controller" {
actions = ["pricing:GetProducts"]
}

statement {
sid = "AllowInterruptionQueueActions"
resources = [aws_sqs_queue.this[0].arn]
actions = [
"sqs:DeleteMessage",
"sqs:GetQueueAttributes",
"sqs:GetQueueUrl",
"sqs:ReceiveMessage"
]
dynamic "statement" {
for_each = local.enable_spot_termination ? [1] : []

content {
sid = "AllowInterruptionQueueActions"
resources = [try(aws_sqs_queue.this[0].arn, null)]
actions = [
"sqs:DeleteMessage",
"sqs:GetQueueAttributes",
"sqs:GetQueueUrl",
"sqs:ReceiveMessage"
]
}
}

statement {
Expand Down

0 comments on commit 671fc6e

Please sign in to comment.