Skip to content

Commit

Permalink
fix: Switch to lazy evaluation for Karpenter node IAM role additional…
Browse files Browse the repository at this point in the history
… permissions attachment (#396)
  • Loading branch information
bryantbiggs committed May 16, 2024
1 parent 7755fb6 commit a9963f4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v4.6.0
hooks:
- id: trailing-whitespace
args: ['--markdown-linebreak-ext=md']
Expand All @@ -11,7 +11,7 @@ repos:
- id: detect-aws-credentials
args: ['--allow-missing-credentials']
- repo: https://github.com/antonbabenko/pre-commit-terraform
rev: v1.88.2
rev: v1.89.1
hooks:
- id: terraform_fmt
- id: terraform_docs
Expand Down
2 changes: 1 addition & 1 deletion main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2989,7 +2989,7 @@ resource "aws_iam_role_policy_attachment" "karpenter" {
}

resource "aws_iam_role_policy_attachment" "additional" {
for_each = { for k, v in try(var.karpenter_node.iam_role_additional_policies, {}) : k => v if local.create_karpenter_node_iam_role }
for_each = { for k, v in lookup(var.karpenter_node, "iam_role_additional_policies", {}) : k => v if local.create_karpenter_node_iam_role }

policy_arn = each.value
role = aws_iam_role.karpenter[0].name
Expand Down

0 comments on commit a9963f4

Please sign in to comment.