-
Notifications
You must be signed in to change notification settings - Fork 37
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
CDK_AWS_PARTITION: Does not fix the OIDC region and audience. #1091
Comments
@mbergkvist since you were the one helping out with the AWS_PARTITION i'm wondering if you can help here? |
@oliott env:
AWS_STS_REGIONAL_ENDPOINTS: regional to the deploy file? In TS it's done with pipeline.workflowFile.patch(JsonPatch.add('/env', { AWS_STS_REGIONAL_ENDPOINTS: 'regional' })); If that doesn't help, please provide the error you get and also how you've setup the trust in the |
Hi thanks for taking time to respond and looking at this. I tried setting this: env:
AWS_STS_REGIONAL_ENDPOINTS: regional But does not really fix the issue. I can paste the entire workflow yaml file here: .github/workflows/deploy-china-partition.yml
The jobs/steps that are failing is the This is the resulting job/step running in github: # Run aws-actions/configure-aws-credentials@v4
with:
aws-region: cn-northwest-1
role-duration-seconds: 1800
role-skip-session-tagging: true
role-to-assume: arn:aws-cn:iam::000000000000:role/DummyOIDCRole
audience: sts.amazonaws.com
env:
AWS_STS_REGIONAL_ENDPOINTS: regional
TEST_ACCOUNT_ID: 000000000000
TEST_OIDC_ROLE_NAME: DummyOIDCRole So the audience ends up pointing to global regardless of me setting that environment variable. |
@oliott Interesting. I see now that I too have
Could it be the
|
I know that the OIDC part is setup correctly because it is working as long as I specify the audience. But I have followed: Configuring OpenID Connect in Amazon Web Services. It does not clearly specify that the audience should be Also the documentation for the action says that the audience for China should be specified as But I can check and see if I can find where the yaml for this action is created and add the audience when applicable. |
I'm curious why it's working for me even though I have Are you using |
No I am not using "Condition": {
"StringEquals": {
"token.actions.githubusercontent.com:aud": "sts.amazonaws.com",
"token.actions.githubusercontent.com:sub": "repo:octo-org/octo-repo:ref:refs/heads/octo-branch"
}
} So I have a Role that has this trust policy but it is Here is the code in question that maybe should create that? src/oidc-provider.ts#L106 |
Hi,
Setting the environment variable
CDK_AWS_PARTITION
as specified here: AWS China partition support, does not make sure that theaudience
andaws-region
of this action: aws-actions/configure-aws-credentials@v4 are configured correctly.This results in the following:
pipeline-definition.yml
The
aws-region
part can be fixed by setting publishAssetsAuthRegion, when creating the pipeline. However the audience is not set tosts.amazonaws.com.cn
which is a requirement for the OIDC authentication to work: OIDC Audience. Because of this the github action to assume the OIDC role will fail.Relevant issues:
Reproducible python code:
requirements.txt
cdk.json
app.py
Version
Python 3.10.0
cdk-pipelines-github version: cdk-pipelines-github==0.4.124
Modifications/environment/deployment
I Have made no modifactions to code environment or deployment that should affect this.
Issue
Setting the environment variable
CDK_AWS_PARTITION
does not setup the OIDC Github Action correctly.Local testing:
cdk.json
,app.py
, andrequirements.txt
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
export TEST_ACCOUNT_ID=<account-id> && export TEST_OIDC_ROLE_NAME=<oicd-role-name>
cdk synth
View the output workflow file in
.github/workflows/
.EDITS:
The text was updated successfully, but these errors were encountered: