fix(cloudformation-include): aws::novalue type validation error for non-string properties#35425
Merged
mergify[bot] merged 7 commits intoaws:mainfrom Sep 18, 2025
Merged
Conversation
kaizencc
reviewed
Sep 5, 2025
...@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.novalue-nonstring.ts
Show resolved
Hide resolved
kaizencc
reviewed
Sep 5, 2025
Contributor
|
Comments on closed issues and PRs are hard for our team to see. |
kaizencc
requested changes
Sep 17, 2025
Contributor
kaizencc
left a comment
There was a problem hiding this comment.
Almost there :). I have two comments to add to the integ test, which you can add verbatim. The reason is because looking at the test by itself it does not make it clear what its testing and how.
...@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.novalue-nonstring.ts
Show resolved
Hide resolved
...@aws-cdk-testing/framework-integ/test/cloudformation-include/test/integ.novalue-nonstring.ts
Show resolved
Hide resolved
…include/test/integ.novalue-nonstring.ts Co-authored-by: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com>
…include/test/integ.novalue-nonstring.ts Co-authored-by: Kaizen Conroy <36202692+kaizencc@users.noreply.github.com>
This file contains hidden or 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
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue # (if applicable)
Closes #18420
Reason for this change
When we try to include a Cloudformation template that uses
{ Ref: 'AWS::NoValue' }for a boolean-typed property, we get an error like:Error: Expected 'true' or 'false' for boolean value, got: '${Token[AWS.NoValue.7]}'This problem occurs because the CFN parser uses the
Aws.NO_VALUEconstant (which is defined as a string). CDK sees a string value for a boolean property and attempts to convert the string to boolean values. This results in the error we see above.Description of changes
This change modifies the CFN parser in cloudformation-include to return a token value instead of a direct string constant for AWS::NoValue references. This makes it an IResolvable token that works with any property type. The parser then, in turn, ignores the default error being thrown whenever a non-string is passed.
Describe any new or updated permissions being added
No new IAM permissions required
Description of how you validated changes
A unit test is added to check if an IResolvable token is returned for AWS::NoValue. An integration test deploys a Cloudformation stack with
AWS::NoValuein a boolean property. Both tests pass. An assertion isn't needed here since the deployment of the infrastructure indicates that the test succeeded.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license