-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core): exportValue does not work on number attributes (#19818)
Number attributes go through two levels of encoding: - L1: because of lack of type information, all attributes are assumed to be `string`s, so we do `Token.asString(new CfnReference(...))`. - L2: we recast select attributes to numbers by doing `Token.asNumber()`. The end result is a Token that looks like: ```ts asNumber(Intrinsic(asString(CfnReference({ 'Fn::GetAtt': [...] })))) ``` When we do `Tokenization.reverse()` on the number, we only reverse the *first* encoding one layer, leaving us with an `Intrinsic` instead of the original `CfnReference`. `exportValue()` then rejects the value as not being the right type of token. Solution: before encoding, try to decode the given value so we always encode the innermost token, and not any of the inbetween ones. Fixes #19537. ---- *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
5 changed files
with
42 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
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
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