From fd723df4fc48b6690129d7c3528c53211b5d299f Mon Sep 17 00:00:00 2001 From: Glaaj <83582518+Glaaj@users.noreply.github.com> Date: Fri, 5 Jan 2024 13:52:33 +0100 Subject: [PATCH 1/2] Update IAM policy --- policy.tf | 38 +++++++++++++++++++++++++++++++------- 1 file changed, 31 insertions(+), 7 deletions(-) diff --git a/policy.tf b/policy.tf index 21801a2..86b3f21 100644 --- a/policy.tf +++ b/policy.tf @@ -1,9 +1,3 @@ -# Generated based on: https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/docs/install/iam_policy.json -# Commit version: https://github.com/kubernetes-sigs/aws-load-balancer-controller/commit/cc59a8c6bd521f2e334b81cb0132652fbb3f5d9d -# Tool used: https://github.com/flosell/iam-policy-json-to-terraform -# Matches chart: version: 1.4.1 -# appVersion: v2.4.1 - data "aws_iam_policy_document" "policy" { statement { @@ -230,6 +224,36 @@ data "aws_iam_policy_document" "policy" { ] } + statement { + sid = "" + effect = "Allow" + + resources = [ + "arn:aws:elasticloadbalancing:*:*:targetgroup/*/*", + "arn:aws:elasticloadbalancing:*:*:loadbalancer/net/*/*", + "arn:aws:elasticloadbalancing:*:*:loadbalancer/app/*/*" + ] + + actions = [ + "elasticloadbalancing:AddTags", + ] + + condition { + test = "StringEquals" + variable = "elasticloadbalancing:CreateAction" + values = [ + "CreateTargetGroup", + "CreateLoadBalancer" + ] + } + + condition { + test = "Null" + variable = "aws:ResourceTag/elbv2.k8s.aws/cluster" + values = ["false"] + } + } + statement { sid = "" effect = "Allow" @@ -277,4 +301,4 @@ data "aws_iam_policy_document" "policy" { "elasticloadbalancing:ModifyRule", ] } -} \ No newline at end of file +} From 7c6b48ef2a0d8dbc44501a72df7b0938ea63f4ab Mon Sep 17 00:00:00 2001 From: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Date: Fri, 5 Jan 2024 12:53:50 +0000 Subject: [PATCH 2/2] Terraform fmt --- policy.tf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/policy.tf b/policy.tf index 86b3f21..20d5457 100644 --- a/policy.tf +++ b/policy.tf @@ -238,10 +238,10 @@ data "aws_iam_policy_document" "policy" { "elasticloadbalancing:AddTags", ] - condition { + condition { test = "StringEquals" variable = "elasticloadbalancing:CreateAction" - values = [ + values = [ "CreateTargetGroup", "CreateLoadBalancer" ]