Skip to content
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

[Enhancement]: Simplify user management with aws_eks_access_entry and aws_eks_access_policy_association #41486

Open
JulesClaussen opened this issue Feb 20, 2025 · 1 comment
Labels
enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. service/eks Issues and PRs that pertain to the eks service.

Comments

@JulesClaussen
Copy link

Description

Hello team,

The EKS resource aws_eks_access_policy_association along with aws_eks_access_entry is quite cumbersome.
As a user, an ideal scenario would be:

  • I create an aws_eks_access_entry for each of my user, and add them into a kubernetes_group
  • I associate a kubernetes_group to a policy association

That would facilitate a lot the user management. Another solution would be to allow multiple policy arns and/or principal_arns with one policy association.
And finally, I believe there should be a datasource to pull the policy by names. Something like:

data "aws_eks_access_policy" "admin-policy" {
  name = "AmazonEKSAdminPolicy"
}

That would greatly improve readability, and be more robust in case of updates.
Thanks!

Affected Resource(s) and/or Data Source(s)

  • aws_eks_access_entry
  • aws_eks_access_policy_association

Potential Terraform Configuration

data "aws_eks_access_policy" "admin" {
  name = "AmazonEKSAdminPolicy"
}

resource "aws_eks_access_entry" "admins" {
  cluster_name   = module.eks.cluster_name
  principal_arns = ["arn-1", "arn-2", "arn-3"]
  kubernetes_groups = ["admins"]
  type           = "STANDARD"
}

#Solution 1:
resource "aws_eks_access_policy_association" "admins" {
  cluster_name  = module.eks.cluster_name
  policy_arn    = data.aws_eks_access_policy.admin
  principal_arns = aws_eks_access_entry.admins.principal_arns
  access_scope {
    type = "cluster"
  }
}

#Solution 2. That could be a new resource like aws_eks_access_policy_group_association:
resource "aws_eks_access_policy_association" "admins" {
  cluster_name  = module.eks.cluster_name
  policy_arn    = data.aws_eks_access_policy.admin
  kubernetes_groups = ["admins"]
  access_scope {
    type = "cluster"
  }
}

References

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_access_entry
https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/eks_access_policy_association

Would you like to implement a fix?

None

@JulesClaussen JulesClaussen added the enhancement Requests to existing resources that expand the functionality or scope. label Feb 20, 2025
Copy link

Community Note

Voting for Prioritization

  • Please vote on this issue by adding a 👍 reaction to the original post to help the community and maintainers prioritize this request.
  • Please see our prioritization guide for information on how we prioritize.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.

Volunteering to Work on This Issue

  • If you are interested in working on this issue, please leave a comment.
  • If this would be your first contribution, please review the contribution guide.

@github-actions github-actions bot added service/eks Issues and PRs that pertain to the eks service. needs-triage Waiting for first response or review from a maintainer. labels Feb 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Requests to existing resources that expand the functionality or scope. needs-triage Waiting for first response or review from a maintainer. service/eks Issues and PRs that pertain to the eks service.
Projects
None yet
Development

No branches or pull requests

1 participant