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

Incorrect token audience with AWS China region #457

Closed
nooperpudd opened this issue Jun 17, 2022 · 1 comment
Closed

Incorrect token audience with AWS China region #457

nooperpudd opened this issue Jun 17, 2022 · 1 comment

Comments

@nooperpudd
Copy link

nooperpudd commented Jun 17, 2022

action with the iam role

uses: aws-actions/configure-aws-credentials@v1
    with:
        role-to-assume: arn:aws-cn:iam::xxxxxx:role/terragrunt
        role-session-name: github-action
        aws-region: cn-north-1

截屏2022-06-17 15 44 50

iam role policy

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Principal": {
                "Federated": "arn:aws-cn:iam::xxxxxxxx:oidc-provider/token.actions.githubusercontent.com"
            },
            "Action": "sts:AssumeRoleWithWebIdentity",
            "Condition": {
                "StringEquals": {
                    "token.actions.githubusercontent.com:sub": "repo:xxxxxx/xxxxxxxxxxxxx:ref:refs/heads/main"
                }
            }
        }
    ]
}

error message: Error: Incorrect token audience

Beijing Region Endpoints
Ningxia Region Endpoints

Beijing STS: sts.cn-north-1.amazonaws.com.cn,
Ningxia STS: sts.cn-northwest-1.amazonaws.com.cn

##[debug]ID token url is https://pipelines.actions.githubusercontent.com/NzAIyiuy4tuga9LIOHtYkwjblAphplgC9tW9NM0QoU7LqwWHx7/00000000-0000-0000-0000-000000000000/_apis/distributedtask/hubs/Actions/plans/d6515396-4c89-4c0f-a5cf-8c5a42b61a2d/jobs/7f892af8-267f-55bf-a254-32b5ccdbaa41/idtoken?api-version=2.0&audience=sts.amazonaws.com
check_suite_focus=true#step:3:177)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants