Skip to content

Commit a6701cc

Browse files
fix: Update IAM Role Trust Policy to allow both main and deploy branches
- Change from StringEquals to StringLike for sub condition - Allow both main and deploy branches in OIDC trust policy - Fix 'Request ARN is invalid' error in GitHub Actions - Update condition to use array format for multiple branch patterns - Ensure proper OIDC authentication for multi-branch deployment
1 parent 2bc4c15 commit a6701cc

2 files changed

Lines changed: 14 additions & 4 deletions

File tree

create_role.ps1

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1051,8 +1051,13 @@ $TRUST_POLICY = @"
10511051
"Action": "sts:AssumeRoleWithWebIdentity",
10521052
"Condition": {
10531053
"StringEquals": {
1054-
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
1055-
"token.actions.githubusercontent.com:sub": "repo:$GITHUB_USERNAME/$GITHUB_REPO_NAME:ref:refs/heads/deploy"
1054+
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
1055+
},
1056+
"StringLike": {
1057+
"token.actions.githubusercontent.com:sub": [
1058+
"repo:$GITHUB_USERNAME/$GITHUB_REPO_NAME:ref:refs/heads/main",
1059+
"repo:$GITHUB_USERNAME/$GITHUB_REPO_NAME:ref:refs/heads/deploy"
1060+
]
10561061
}
10571062
}
10581063
}

create_role.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1054,8 +1054,13 @@ TRUST_POLICY=$(cat <<EOF
10541054
"Action": "sts:AssumeRoleWithWebIdentity",
10551055
"Condition": {
10561056
"StringEquals": {
1057-
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
1058-
"token.actions.githubusercontent.com:sub": "repo:$GITHUB_USERNAME/$GITHUB_REPO_NAME:ref:refs/heads/deploy"
1057+
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com"
1058+
},
1059+
"StringLike": {
1060+
"token.actions.githubusercontent.com:sub": [
1061+
"repo:$GITHUB_USERNAME/$GITHUB_REPO_NAME:ref:refs/heads/main",
1062+
"repo:$GITHUB_USERNAME/$GITHUB_REPO_NAME:ref:refs/heads/deploy"
1063+
]
10591064
}
10601065
}
10611066
}

0 commit comments

Comments
 (0)