Skip to content

feat: Update AWS Load Balancer controller policy to match v2.13 of the upstream project #573

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

RafiGreenberg
Copy link
Contributor

@RafiGreenberg RafiGreenberg commented Jun 4, 2025

Description

Latest release of AWS LBC (v2.13.x) adds this permission ec2:DescribeRouteTables

Motivation and Context

latest IAM Policy for AWS LBC: https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/docs/install/iam_policy.json

Breaking Changes

No.

Testing

  • Tested using my fork:
module "aws_load_balancer_controller_irsa" {
  source = "git::https://github.com/RafiGreenberg/terraform-aws-iam//modules/iam-role-for-service-accounts-eks"

  role_name = "aws-load-balancer-controller"

  attach_load_balancer_controller_policy = true
  oidc_providers = {
    main = {
      provider_arn               = module.eks.oidc_provider_arn
      namespace_service_accounts = ["kube-system:aws-load-balancer-controller"]
    }
  }
}
  • Plan:
$ tf plan
~ resource "aws_iam_policy" "load_balancer_controller" {
        id               = "arn:aws:iam::xxxxx:policy/AmazonEKS_AWS_Load_Balancer_Controller-20250603185119521400000001"
        name             = "AmazonEKS_AWS_Load_Balancer_Controller-20250603185119521400000001"
      ~ policy           = jsonencode(
          ~ {
              ~ Statement = [
                    {
                        Action    = "iam:CreateServiceLinkedRole"
                        Condition = {
                            StringEquals = {
                                "iam:AWSServiceName" = "elasticloadbalancing.amazonaws.com"
                            }
                        }
                        Effect    = "Allow"
                        Resource  = "*"
                    },
                  ~ {
                      ~ Action   = [
                            # (19 unchanged elements hidden)
                            "ec2:DescribeSecurityGroups",
                          + "ec2:DescribeRouteTables",
                            "ec2:DescribeNetworkInterfaces",
                            # (7 unchanged elements hidden)
                        ]
                        # (2 unchanged attributes hidden)
                    },
                    {
                        Action   = [
                            "wafv2:GetWebACLForResource",
                            "wafv2:GetWebACL",
                            "wafv2:DisassociateWebACL",
                            "wafv2:AssociateWebACL",
                            "waf-regional:GetWebACLForResource",
                            "waf-regional:GetWebACL",
                            "waf-regional:DisassociateWebACL",
                            "waf-regional:AssociateWebACL",
                            "shield:GetSubscriptionState",
                            "shield:DescribeProtection",
                            "shield:DeleteProtection",
                            "shield:CreateProtection",
                            "iam:ListServerCertificates",
                            "iam:GetServerCertificate",
                            "cognito-idp:DescribeUserPoolClient",
                            "acm:ListCertificates",
                            "acm:DescribeCertificate",
                        ]
                        Effect   = "Allow"
                        Resource = "*"
                    },
                    # (12 unchanged elements hidden)
                ]
                # (1 unchanged attribute hidden)
            }
        )
        tags             = {}
        # (7 unchanged attributes hidden)
    }
Plan: 0 to add, 1 to change, 0 to destroy.

Tested successfully - ingress using ALB works now

Events:
  Type    Reason                  Age    From     Message
  ----    ------                  ----   ----     -------
  Normal  SuccessfullyReconciled  4m45s  ingress  Successfully reconciled

Closes: #568

Latest release of AWS LBC (v2.13.x) adds this permission `ec2:DescribeRouteTables`

Motivation and Context
latest IAM Policy for AWS LBC: https://github.com/kubernetes-sigs/aws-load-balancer-controller/blob/main/docs/install/iam_policy.json

Breaking Changes
No.

How Has This Been Tested?
 I have updated at least one of the examples/* to demonstrate and validate my change(s)
 I have tested and validated these changes using one or more of the provided examples/* projects
 I have executed pre-commit run -a on my pull request

Closes: terraform-aws-modules#568
@RafiGreenberg
Copy link
Contributor Author

Breaking PR was: kubernetes-sigs/aws-load-balancer-controller#4109

@bryantbiggs bryantbiggs changed the title fix: Update IAM permissions for load balancer controller 2.13.x feat: Update AWS Load Balancer controller policy to match v2.13 of the upstream project Jun 4, 2025
@bryantbiggs bryantbiggs merged commit 4ce604e into terraform-aws-modules:master Jun 4, 2025
35 checks passed
antonbabenko pushed a commit that referenced this pull request Jun 4, 2025
## [5.56.0](v5.55.0...v5.56.0) (2025-06-04)

### Features

* Update AWS Load Balancer controller policy to match v2.13 of the upstream project ([#573](#573)) ([4ce604e](4ce604e))
@antonbabenko
Copy link
Member

This PR is included in version 5.56.0 🎉

Copy link

github-actions bot commented Jul 5, 2025

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 5, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong Policy gets attach when using variables attach_load_balancer_controller_policy
3 participants