Skip to content

Commit

Permalink
Use inline policy for v1beta to avoid resource recreation
Browse files Browse the repository at this point in the history
This is a cherry-picked commit with changes in #372
  • Loading branch information
coord-e committed Oct 30, 2024
1 parent 43bf6a2 commit c171d0b
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions modules/karpenter/controller_iam.tf
Original file line number Diff line number Diff line change
Expand Up @@ -289,15 +289,10 @@ data "aws_iam_policy_document" "karpenter_controller_v1_alpha" {
}
}

resource "aws_iam_role_policy_attachment" "karpenter_controller_v1_beta" {
count = var.v1beta ? 1 : 0
role = aws_iam_role.karpenter_controller.id
policy_arn = aws_iam_policy.karpenter_controller_v1_beta[0].arn
}

resource "aws_iam_policy" "karpenter_controller_v1_beta" {
resource "aws_iam_role_policy" "karpenter_controller_v1_beta" {
count = var.v1beta ? 1 : 0
name = "${var.cluster_config.iam_policy_name_prefix}KarpenterController-v1beta-${var.cluster_config.name}"
name = "KarpenterController-v1beta"
role = aws_iam_role.karpenter_controller.id
policy = data.aws_iam_policy_document.karpenter_controller_v1_beta.json
}

Expand Down

0 comments on commit c171d0b

Please sign in to comment.