-
Notifications
You must be signed in to change notification settings - Fork 229
Feat/support china partition merge #687
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
base: master
Are you sure you want to change the base?
Feat/support china partition merge #687
Conversation
import os | ||
from boto3.session import Session | ||
|
||
REGION = os.getenv("AWS_REGION", "us-east-1") | ||
PARTITION = Session().get_partition_for_region(REGION) | ||
|
||
if PARTITION == "aws-cn": | ||
from .stubs import stub_iam_cn as stub_iam | ||
else: | ||
from .stubs import stub_iam |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we not just having separate tests for each region here? Adding this logic to the tests doesnt' seem right.
|
||
@fixture | ||
def iam_client(): | ||
client = Mock() | ||
client.get_role_policy.side_effect = ( | ||
lambda **kwargs: deepcopy(stub_iam.get_role_policy) | ||
lambda **kwargs: deepcopy(stub_iam.get_role_policy) if PARTITION == "aws-cn" else deepcopy(stub_iam.get_role_policy) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the same logic each side of the if check here. Is this needed?
@@ -188,7 +196,10 @@ def test_grant_access_to_kms_keys_new_key_single_resource(iam_client): | |||
) | |||
policy_doc_before = deepcopy(instance.policy_document) | |||
|
|||
new_key_arn = 'arn:aws:kms:eu-west-1:111111111111:key/new_key' | |||
|
|||
test_region = "eu-west-1" if PARTITION == "aws-cn" else "cn-north-1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Logic in the tests seems like a red flag. Also "eu-west-1" IF partition == aws-cn seems incorrect
if region != "cn-north-1": | ||
return | ||
else: | ||
extra_deploy_region = "cn-northwest-1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be statically defined, or supplied by the user?
Why?
ADF Support for China Partition
This pull request introduces support for the China partition in the AWS Deployment Framework (ADF). It adds necessary support for the unique requirements and configurations specific to the China region endpoints, base region and core ADF services.
This addition enables users in Beijing region to leverage the full capabilities of ADF tailored to their environment. The changes have been tested to guarantee compatibility with Global and Govcloud.
Any feedback, suggestions, or required adjustments are highly appreciated.
What?
Description of changes:
By submitting this pull request, I confirm that you can use, modify, copy, and
redistribute this contribution, under the terms of your choice.