Skip to content

Commit 470bcc2

Browse files
Update IAM policy template
This is the same fix included upstream kubernetes-sigs/aws-load-balancer-controller#3046
1 parent 2b1fcf0 commit 470bcc2

File tree

1 file changed

+34
-1
lines changed

1 file changed

+34
-1
lines changed

iam.tf

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,39 @@ data "aws_iam_policy_document" "lb_controller" {
268268
effect = "Allow"
269269
}
270270

271+
statement {
272+
actions = [
273+
"elasticloadbalancing:AddTags"
274+
]
275+
276+
resources = [
277+
"arn:${var.arn_format}:elasticloadbalancing:*:*:targetgroup/*/*",
278+
"arn:${var.arn_format}:elasticloadbalancing:*:*:loadbalancer/net/*/*",
279+
"arn:${var.arn_format}:elasticloadbalancing:*:*:loadbalancer/app/*/*"
280+
]
281+
282+
condition {
283+
test = "StringEquals"
284+
variable = "elasticloadbalancing:CreateAction"
285+
286+
values = [
287+
"CreateTargetGroup",
288+
"CreateLoadBalancer"
289+
]
290+
}
291+
292+
condition {
293+
test = "Null"
294+
variable = "aws:RequestTag/elbv2.k8s.aws/cluster"
295+
296+
values = [
297+
"false"
298+
]
299+
}
300+
301+
effect = "Allow"
302+
}
303+
271304
statement {
272305
actions = [
273306
"elasticloadbalancing:ModifyLoadBalancerAttributes",
@@ -368,4 +401,4 @@ resource "aws_iam_role_policy_attachment" "lb_controller" {
368401
count = var.enabled ? 1 : 0
369402
role = aws_iam_role.lb_controller[0].name
370403
policy_arn = aws_iam_policy.lb_controller[0].arn
371-
}
404+
}

0 commit comments

Comments
 (0)