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

feat: Add aws-cn support #1547

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

mbergkvist
Copy link

  • Use AWS::Partition when creating ARN in IAM policy statement, the current partition will be resolved by CloudFormation during deployment.
  • The aws partition is not known in all parts of the CDK application when synthesizing. Adding an option to set the partition in an environment variable, enables e.g. Constructs to take decisions based on that.
  • Custom resource lambdas operating AWS Organizations uses the correct endpoint based on the partition information.
  • The changes are backwards compatible due to defaulting to us-east-1 endpoint if the CDK_AWS_PARTITION is not set.
  • The environment variable has also been introduced in feat: option to configure partition with env var cdklabs/cdk-pipelines-github#895.
  • These changes are tested in a CDK project with two applications to deploy to both aws and aws-cn partitions, using shared stacks and other resource implementations.

More comments on each commit.

Fixes #

@mbergkvist mbergkvist changed the title Add aws-cn support feat: Add aws-cn support Feb 29, 2024
@mbergkvist mbergkvist marked this pull request as ready for review February 29, 2024 07:40
The PARTITION is resolved by CloudFormation during deployment.
The organizations endpoint region defaults to us-east-1 but is set to
cn-northwest-1 if the environment variable CDK_AWS_PARTITION is set to
aws-cn when synthesizing the stacks.

The organizations endpoint region is propagated to the custom resources
through the ORGANIZATIONS_ENDPOINT_REGION environment variable.
The region should be available in ORGANIZATIONS_ENDPOINT_REGION, but it
defaults to us-east-1 if the value is missing.
@mbergkvist
Copy link
Author

@pflorek Is this ok to be merged? dependabot keeps creating conflicts with this pr and I want to avoid fixing those until it is ready to merge.

@mbergkvist
Copy link
Author

The changes are backwards compatible due to defaulting to us-east-1 endpoint if the CDK_AWS_PARTITION is not set.
The environment variable has also been introduced in cdklabs/cdk-pipelines-github#895.

cdklabs/cdk-pipelines-github#895 has been merged and released https://github.com/cdklabs/cdk-pipelines-github/releases/tag/v0.4.114.

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

Successfully merging this pull request may close these issues.

None yet

1 participant