Closed rirze closed 3 years ago
You can turn the value into a fake number by calling Token.asNumber()
. This will allow you to escape the type system of your language, if you are convinced that everything is alright at deploy time.
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
I'm trying to use a value from an API call (via AWSCustomResource and AWSApiCall objects) to set a parameter for another resource. However, I am unable to do synthesize, since JSII complains about the parameter being an string (
$Token[...]
) instead of being an integer as expected.Reproduction Steps
The following is a code sample to illustrate the idea, but is not exactly functional. If desired, I can post my exact code, but I believe this is enough to discuss the scope of the issue.
What did you expect to happen?
Ideally, I could have a smart WAF RuleGroup class that calls the Api call
wafv2.CheckCapacity
and dynamically sets the RuleGroup capacity automatically during synthesis. During deployment, it would ideally create all dependent resources first and then issue the call and then create the RuleGroup using the result from the Api call.What actually happened?
Synthesis fails, since JSII doesn't like that a token/reference is being passed into one of the parameters instead of a proper integer.
Environment
Other
This is :bug: Bug Report