Skip to content

Commit

Permalink
docs(iam): hints at accountId as string type (aws#22149)
Browse files Browse the repository at this point in the history
----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/main/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/main/INTEGRATION_TESTS.md)?
	* [ ] Did you use `yarn integ` to deploy the infrastructure and generate the snapshot (i.e. `yarn integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*

---

With the merge of [aws#20292](aws#20292) the accountID type was essentially required to be a string with the exception of an unencoded token. So, while the type of accountId cannot be set to string and must remain any to preserve compatibility, the hint for accountId should at least suggest that a string should be used rather than an int.
  • Loading branch information
misterjacko authored and madeline-k committed Oct 10, 2022
1 parent b1d8fd4 commit 026e930
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/@aws-cdk/aws-iam/lib/principals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ export class AccountPrincipal extends ArnPrincipal {

/**
*
* @param accountId AWS account ID (i.e. 123456789012)
* @param accountId AWS account ID (i.e. '123456789012')
*/
constructor(public readonly accountId: any) {
super(new StackDependentToken(stack => `arn:${stack.partition}:iam::${accountId}:root`).toString());
Expand Down Expand Up @@ -936,4 +936,4 @@ export function validateConditionObject(x: unknown): asserts x is Record<string,
if (!x || typeof x !== 'object' || Array.isArray(x)) {
throw new Error('A Condition should be represented as a map of operator to value');
}
}
}

0 comments on commit 026e930

Please sign in to comment.