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

fix: Correct cluster access entry to create multiple policy associations per access entry #2892

Merged

Conversation

bryantbiggs
Copy link
Member

Description

  • Correct cluster access entry to create one entry and multiple policy associations. Currently, it is trying to use the flattened logic that was intended for supporting multiple policy associations
    • Want: Per access entry, support multiple policy associations
    • Current: One access entry per policy association, and if multiple policies are provided, it will fail since entry already exists

Motivation and Context

Breaking Changes

  • Technically, yes - the looping logic of the access entry has changed. However, this is not working as it was intended and we are coming off a breaking change so I am inclined to add this as a bugfix since it was never working as intended from the last major release

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

@@ -168,28 +168,22 @@ locals {
for pol_key, pol_val in lookup(entry_val, "policy_associations", {}) :
merge(
{
principal_arn = entry_val.principal_arn
kubernetes_groups = lookup(entry_val, "kubernetes_groups", [])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kubernetes_groups, tags, type, and user_name are used in the access entry, not in the policy association. So these are not used here and can be removed

)
]
])
}

resource "aws_eks_access_entry" "this" {
for_each = { for k, v in local.flattened_access_entries : "${v.entry_key}_${v.pol_key}" => v if local.create }
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the issue thats technically breaking, but its not working as intended on v20

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is acceptable for a quick-fix release like "5 second rule"

https://en.wikipedia.org/wiki/Five-second_rule 🤣

@bryantbiggs bryantbiggs changed the title fix: Correct cluster access entry to create one entry and multiple policy associations fix: Correct cluster access entry to create multiple policy associations per access entry Feb 2, 2024
)
]
])
}

resource "aws_eks_access_entry" "this" {
for_each = { for k, v in local.flattened_access_entries : "${v.entry_key}_${v.pol_key}" => v if local.create }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is acceptable for a quick-fix release like "5 second rule"

https://en.wikipedia.org/wiki/Five-second_rule 🤣

@bryantbiggs bryantbiggs merged commit 4177913 into terraform-aws-modules:master Feb 3, 2024
18 checks passed
@bryantbiggs bryantbiggs deleted the docs/cam-examples branch February 3, 2024 11:47
antonbabenko pushed a commit that referenced this pull request Feb 3, 2024
### [20.0.1](v20.0.0...v20.0.1) (2024-02-03)

### Bug Fixes

* Correct cluster access entry to create multiple policy associations per access entry ([#2892](#2892)) ([4177913](4177913))
@antonbabenko
Copy link
Member

This PR is included in version 20.0.1 🎉

@hmih
Copy link

hmih commented Feb 3, 2024

I am already using this in production lol. Nevermind my edits, I hadn't checked the diff. Great job!

Copy link

github-actions bot commented Mar 5, 2024

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 Mar 5, 2024
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.

3 participants