Skip to content

Conversation

dgandhi62
Copy link
Contributor

@dgandhi62 dgandhi62 commented Sep 5, 2025

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_VALUE constant (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::NoValue in 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

@dgandhi62 dgandhi62 requested a review from a team as a code owner September 5, 2025 17:05
@github-actions github-actions bot added bug This issue is a bug. effort/small Small work item – less than a day of effort p2 labels Sep 5, 2025
@aws-cdk-automation aws-cdk-automation requested a review from a team September 5, 2025 17:05
@github-actions github-actions bot added the beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK label Sep 5, 2025
@mergify mergify bot added the contribution/core This is a PR that came from AWS. label Sep 5, 2025
@aws-cdk-automation aws-cdk-automation added the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Sep 5, 2025
@dgandhi62 dgandhi62 changed the title fix(cloudformation-include): aws::novalue handling in boolean properties fix(cloudformation-include): aws::novalue type validation error for non-string properties Sep 5, 2025
@dgandhi62 dgandhi62 closed this Sep 8, 2025
@dgandhi62 dgandhi62 deleted the fix-novalue-boolean-support branch September 8, 2025 17:24
@dgandhi62 dgandhi62 restored the fix-novalue-boolean-support branch September 8, 2025 17:24
Copy link
Contributor

github-actions bot commented Sep 8, 2025

Comments on closed issues and PRs are hard for our team to see.
If you need help, please open a new issue that references this one.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 8, 2025
@dgandhi62 dgandhi62 reopened this Sep 9, 2025
@dgandhi62 dgandhi62 self-assigned this Sep 16, 2025
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-automation aws-cdk-automation removed the pr/needs-maintainer-review This PR needs a review from a Core Team Member label Sep 17, 2025
dgandhi62 and others added 3 commits September 18, 2025 11:19
…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>
Copy link
Contributor

@kaizencc kaizencc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yay!

@mergify mergify bot merged commit ce76a56 into aws:main Sep 18, 2025
20 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
beginning-contributor [Pilot] contributed between 0-2 PRs to the CDK bug This issue is a bug. contribution/core This is a PR that came from AWS. effort/small Small work item – less than a day of effort p2
Projects
None yet
Development

Successfully merging this pull request may close these issues.

(cfn-include): AWS::NoValue fails for a boolean-typed property
4 participants