Skip to content

Commit dfabd51

Browse files
committed
Fix SSO role ARN resolution for EKS access entries
SSO roles include a path prefix (e.g. /aws-reserved/sso.amazonaws.com/REGION/) that EKS requires in access entries. The previous manual ARN construction stripped this path, causing InvalidParameterException. Use `aws iam get-role` to resolve the full canonical ARN.
1 parent b08be30 commit dfabd51

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

deploy.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,12 @@ fi
252252
if [ -z "$BUILD_ID" ]; then
253253
# Resolve caller's IAM role ARN for EKS access grants.
254254
# For assumed-role ARNs (arn:aws:sts::ACCT:assumed-role/RoleName/session),
255-
# convert to the IAM role ARN (arn:aws:iam::ACCT:role/RoleName).
255+
# look up the full IAM role ARN via get-role. SSO roles include a path
256+
# (e.g. /aws-reserved/sso.amazonaws.com/REGION/) that EKS requires.
256257
CALLER_ROLE_ARN=""
257258
if echo "$IDENTITY_ARN" | grep -q "assumed-role"; then
258259
ROLE_NAME="$(echo "$IDENTITY_ARN" | cut -d'/' -f2)"
259-
CALLER_ROLE_ARN="arn:aws:iam::${ACCOUNT_ID}:role/${ROLE_NAME}"
260+
CALLER_ROLE_ARN="$(aws iam get-role --role-name "$ROLE_NAME" --query 'Role.Arn' --output text 2>/dev/null || true)"
260261
fi
261262

262263
ENV_OVERRIDES='[

0 commit comments

Comments
 (0)