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

fix(iam): AccountPrincipal accepts values which aren't account IDs #20292

Merged
merged 9 commits into from
May 19, 2022
3 changes: 3 additions & 0 deletions allowed-breaking-changes.txt
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,6 @@ removed:@aws-cdk/aws-lambda-event-sources.SelfManagedKafkaEventSourceProps.onFai

# removed kubernetes version from EKS
removed:@aws-cdk/aws-eks.KubernetesVersion.V1_22

# changed the type of AccountPrincipal argument accountId's type to string
incompatible-argument:@aws-cdk/aws-iam.AccountPrincipal.<initializer>
2 changes: 1 addition & 1 deletion packages/@aws-cdk/aws-iam/lib/principals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ export class AccountPrincipal extends ArnPrincipal {
*
* @param accountId AWS account ID (i.e. 123456789012)
*/
constructor(public readonly accountId: any) {
constructor(public readonly accountId: string) {
super(new StackDependentToken(stack => `arn:${stack.partition}:iam::${accountId}:root`).toString());
this.principalAccount = accountId;
}
Expand Down