Skip to content

Commit f59231c

Browse files
authored
Remove (broken) root access to EKS clusters (#668)
1 parent e0bdd0b commit f59231c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

modules/eks/cluster/main.tf

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,13 @@ locals {
1515
(local.identity_account_name) = var.aws_teams_rbac[*].aws_team
1616
}, {
1717
(local.this_account_name) = var.aws_team_roles_rbac[*].aws_team_role
18-
root = ["*"]
1918
})
2019

2120
aws_teams_auth = [for role in var.aws_teams_rbac : {
22-
rolearn = module.iam_arns.principals_map[local.identity_account_name][role.aws_team]
23-
username = format("%s-%s", local.identity_account_name, role.aws_team)
21+
rolearn = module.iam_arns.principals_map[local.identity_account_name][role.aws_team]
22+
# Include session name in the username for auditing purposes.
23+
# See https://aws.github.io/aws-eks-best-practices/security/docs/iam/#use-iam-roles-when-multiple-users-need-identical-access-to-the-cluster
24+
username = format("%s-%s::{{SessionName}}", local.identity_account_name, role.aws_team)
2425
groups = role.groups
2526
}]
2627

0 commit comments

Comments
 (0)