-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(route53): allow specifying an STS region when creating a cross-a…
…ccount zone delegation (#29466) ### Issue # (if applicable) n/a ### Reason for this change In certain circumstances, the default STS region resolution logic will not properly select a region due to the hardcoded mapping between region prefixes and STS regions. ### Description of changes This change allows callers to specify a region in which STS will be called. ### Description of how you validated changes Unit tests were added to aws-cdk-lib. Integ tests were updated and pass on my personal accounts, but I'm not sure how to check if they'll pass in CI. ### Checklist - [x] My code adheres to the [CONTRIBUTING GUIDE](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md) and [DESIGN GUIDELINES](https://github.com/aws/aws-cdk/blob/main/docs/DESIGN_GUIDELINES.md) ---- *By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
- Loading branch information
Showing
23 changed files
with
615 additions
and
33 deletions.
There are no files selected for viewing
1 change: 0 additions & 1 deletion
1
....snapshot/asset.aca4a134bf7ace6088b21213be7ab4357e3705f714362b690d76376b8f1df53a/index.js
This file was deleted.
Oops, something went wrong.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
....snapshot/asset.f43e5ef82b45e2e3ecb60cd54aa4a3599da7bb4c85d10cfe133dc43f54705458/index.js
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
34 changes: 34 additions & 0 deletions
34
...ccount-zone-delegation.js.snapshot/child-opt-in-stack-with-assume-role-region.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
159 changes: 159 additions & 0 deletions
159
...ount-zone-delegation.js.snapshot/child-opt-in-stack-with-assume-role-region.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
{ | ||
"Resources": { | ||
"SubZoneF7955E1A": { | ||
"Type": "AWS::Route53::HostedZone", | ||
"Properties": { | ||
"Name": "sub3.uniqueexample.com." | ||
} | ||
}, | ||
"delegatecrossaccountzonedelegationhandlerrolePolicychildoptinstackwithassumeroleregiondelegatecrossaccountzonedelegationhandlerroleA822DAE1970772B0": { | ||
"Type": "AWS::IAM::Policy", | ||
"Properties": { | ||
"PolicyDocument": { | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Resource": "arn:aws:iam::12345678:role/MyUniqueDelegationRole" | ||
} | ||
], | ||
"Version": "2012-10-17" | ||
}, | ||
"PolicyName": "PolicychildoptinstackwithassumeroleregiondelegatecrossaccountzonedelegationhandlerroleA822DAE1", | ||
"Roles": [ | ||
{ | ||
"Fn::Select": [ | ||
1, | ||
{ | ||
"Fn::Split": [ | ||
"/", | ||
{ | ||
"Fn::Select": [ | ||
5, | ||
{ | ||
"Fn::Split": [ | ||
":", | ||
{ | ||
"Fn::GetAtt": [ | ||
"CustomCrossAccountZoneDelegationCustomResourceProviderRoleED64687B", | ||
"Arn" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} | ||
}, | ||
"delegateCrossAccountZoneDelegationCustomResource23BD590B": { | ||
"Type": "Custom::CrossAccountZoneDelegation", | ||
"Properties": { | ||
"ServiceToken": { | ||
"Fn::GetAtt": [ | ||
"CustomCrossAccountZoneDelegationCustomResourceProviderHandler44A84265", | ||
"Arn" | ||
] | ||
}, | ||
"AssumeRoleArn": "arn:aws:iam::12345678:role/MyUniqueDelegationRole", | ||
"ParentZoneName": "uniqueexample.com", | ||
"DelegatedZoneName": "sub3.uniqueexample.com", | ||
"DelegatedZoneNameServers": { | ||
"Fn::GetAtt": [ | ||
"SubZoneF7955E1A", | ||
"NameServers" | ||
] | ||
}, | ||
"TTL": 172800, | ||
"AssumeRoleRegion": "eu-west-1" | ||
}, | ||
"DependsOn": [ | ||
"delegatecrossaccountzonedelegationhandlerrolePolicychildoptinstackwithassumeroleregiondelegatecrossaccountzonedelegationhandlerroleA822DAE1970772B0" | ||
], | ||
"UpdateReplacePolicy": "Delete", | ||
"DeletionPolicy": "Delete" | ||
}, | ||
"CustomCrossAccountZoneDelegationCustomResourceProviderRoleED64687B": { | ||
"Type": "AWS::IAM::Role", | ||
"Properties": { | ||
"AssumeRolePolicyDocument": { | ||
"Version": "2012-10-17", | ||
"Statement": [ | ||
{ | ||
"Action": "sts:AssumeRole", | ||
"Effect": "Allow", | ||
"Principal": { | ||
"Service": "lambda.amazonaws.com" | ||
} | ||
} | ||
] | ||
}, | ||
"ManagedPolicyArns": [ | ||
{ | ||
"Fn::Sub": "arn:${AWS::Partition}:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole" | ||
} | ||
] | ||
} | ||
}, | ||
"CustomCrossAccountZoneDelegationCustomResourceProviderHandler44A84265": { | ||
"Type": "AWS::Lambda::Function", | ||
"Properties": { | ||
"Code": { | ||
"S3Bucket": "cdk-hnb659fds-assets-234567890123-af-south-1", | ||
"S3Key": "f43e5ef82b45e2e3ecb60cd54aa4a3599da7bb4c85d10cfe133dc43f54705458.zip" | ||
}, | ||
"Timeout": 900, | ||
"MemorySize": 128, | ||
"Handler": "__entrypoint__.handler", | ||
"Role": { | ||
"Fn::GetAtt": [ | ||
"CustomCrossAccountZoneDelegationCustomResourceProviderRoleED64687B", | ||
"Arn" | ||
] | ||
}, | ||
"Runtime": "nodejs18.x" | ||
}, | ||
"DependsOn": [ | ||
"CustomCrossAccountZoneDelegationCustomResourceProviderRoleED64687B" | ||
] | ||
} | ||
}, | ||
"Parameters": { | ||
"BootstrapVersion": { | ||
"Type": "AWS::SSM::Parameter::Value<String>", | ||
"Default": "/cdk-bootstrap/hnb659fds/version", | ||
"Description": "Version of the CDK Bootstrap resources in this environment, automatically retrieved from SSM Parameter Store. [cdk:skip]" | ||
} | ||
}, | ||
"Rules": { | ||
"CheckBootstrapVersion": { | ||
"Assertions": [ | ||
{ | ||
"Assert": { | ||
"Fn::Not": [ | ||
{ | ||
"Fn::Contains": [ | ||
[ | ||
"1", | ||
"2", | ||
"3", | ||
"4", | ||
"5" | ||
], | ||
{ | ||
"Ref": "BootstrapVersion" | ||
} | ||
] | ||
} | ||
] | ||
}, | ||
"AssertDescription": "CDK bootstrap stack version 6 required. Please run 'cdk bootstrap' with a recent version of the CDK CLI." | ||
} | ||
] | ||
} | ||
} | ||
} |
10 changes: 5 additions & 5 deletions
10
...ute53/test/integ.cross-account-zone-delegation.js.snapshot/child-opt-in-stack.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 5 additions & 5 deletions
10
.../aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/child-stack.assets.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 2 additions & 1 deletion
3
...rk-integ/test/aws-route53/test/integ.cross-account-zone-delegation.js.snapshot/integ.json
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.