Skip to content

Commit

Permalink
[eks/cluster] Fix AWS SSO support (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nuru authored Jun 20, 2024
1 parent 4211160 commit 23f29cc
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
15 changes: 13 additions & 2 deletions modules/eks/cluster/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
## Release 1.466.1
## Release 1.468.0

PR [#1072](https://github.com/cloudposse/terraform-aws-components/pull/1072)

Bugfix:

- Correctly map AWS SSO Permission Sets referenced by `aws_sso_permission_sets_rbac` to IAM Role ARNs.
- Broken in Release 1.431.1: Update to use AWS Auth API

## Release 1.467.0

PR [#1071](https://github.com/cloudposse/terraform-aws-components/pull/1071)

Expand Down Expand Up @@ -34,7 +43,9 @@ script.
This support should be considered an `alpha` version, as it may change when support for Amazon Linux 2023 is added, and
does not work with Bottlerocket.

## Breaking Changes: Components PR [#1033](https://github.com/cloudposse/terraform-aws-components/pull/1033)
## Release 1.431.1: Breaking Changes

Components PR [#1033](https://github.com/cloudposse/terraform-aws-components/pull/1033)

### Major Breaking Changes

Expand Down
11 changes: 10 additions & 1 deletion modules/eks/cluster/aws-sso.tf
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
locals {

aws_sso_access_entry_map = {
for role in var.aws_sso_permission_sets_rbac : data.aws_iam_roles.sso_roles[role.aws_sso_permission_set] => {
for role in var.aws_sso_permission_sets_rbac : tolist(data.aws_iam_roles.sso_roles[role.aws_sso_permission_set].arns)[0] => {
kubernetes_groups = role.groups
}
}
Expand All @@ -14,4 +14,13 @@ data "aws_iam_roles" "sso_roles" {
for_each = toset(var.aws_sso_permission_sets_rbac[*].aws_sso_permission_set)
name_regex = format("AWSReservedSSO_%s_.*", each.value)
path_prefix = "/aws-reserved/sso.amazonaws.com/"

lifecycle {
postcondition {
condition = length(self.arns) == 1
error_message = length(self.arns) == 0 ? "Could not find Role ARN for the AWS SSO permission set: ${each.value}" : (
"Found more than one (${length(self.arns)}) Role ARN for the AWS SSO permission set: ${each.value}"
)
}
}
}

0 comments on commit 23f29cc

Please sign in to comment.