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

Add aws cn support #819

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/oidc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export interface GitHubActionRoleProps {
* You must `cdk deploy` once (with your normal AWS credentials) to have this role created for you.
*
* You can then make note of the role arn in the stack output and send it into the Github Workflow app via
* the `gitHubActionRoleArn` property. The role arn will be `arn:aws:iam::<accountId>:role/GithubActionRole`.
* the `gitHubActionRoleArn` property. The role arn will be `arn:<partition>:iam::<accountId>:role/GithubActionRole`.
*
* @see https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-amazon-web-services
*/
Expand All @@ -91,7 +91,7 @@ export class GitHubActionRole extends Construct {
return iam.OpenIdConnectProvider.fromOpenIdConnectProviderArn(
scope,
'GitHubActionProvider',
`arn:aws:iam::${Aws.ACCOUNT_ID}:oidc-provider/token.actions.githubusercontent.com`,
`arn:${Aws.PARTITION}:iam::${Aws.ACCOUNT_ID}:oidc-provider/token.actions.githubusercontent.com`,
);
}

Expand Down Expand Up @@ -174,4 +174,4 @@ function formatRepos(repos: string[]) {
formattedRepos.push(`repo:${repo}:*`);
}
return formattedRepos;
}
}
5 changes: 3 additions & 2 deletions src/pipeline.ts
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ export class GitHubWorkflow extends PipelineBase {
return EnvironmentPlaceholders.replace(s, {
accountId: account,
region: region,
partition: 'aws',
partition: 'aws-cn',
});
};

Expand All @@ -573,7 +573,8 @@ export class GitHubWorkflow extends PipelineBase {
if (this.assetHashMap[hash] === undefined) {
throw new Error(`Template asset hash ${hash} not found.`);
}
return template.replace(hash, `\${{ needs.${this.assetHashMap[hash]}.outputs.${ASSET_HASH_NAME} }}`);
return template.replace(hash, `\${{ needs.${this.assetHashMap[hash]}.outputs.${ASSET_HASH_NAME} }}`)
.replace('.amazonaws.com', '.amazonaws.com.cn');
};

const params: Record<string, any> = {
Expand Down
Loading