You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating an EBS volume using ServiceManagedVolume, floating-point values for the size parameter are not automatically rounded, leading to CloudFormation deployment/validation failures that are difficult to debug. I believe the issue occurs because CloudFormation expects integer values for SizeInGiB, but floating-point numbers in the synthesized YAML are interpreted as strings.
The root cause here seemed to be that CDK generated a config value SizeInGiB: 193.60000000000002 which the API model expected to be a number but the 193.60000000000002 value was treated as a string. Can this be an error or warning at build time instead?
You've correctly identified the root cause: CDK currently allows floating-point values for the size property of an EBS volume, which results in CloudFormation runtime validation failures due to non-integer values like 193.60000000000002. This is synthesized directly into the CloudFormation template without rounding or validation, leading to confusing deployment errors.
We agree this should be caught or handled earlier in the development lifecycle.
Next steps:
We will explore adding validation or automatic rounding inside CDK to ensure that only integer values are passed to CloudFormation.
Ideally, CDK would apply something like Math.ceil() automatically on your behalf or throw a descriptive error at build time.
For now, your workaround — manually wrapping the float calculation in Math.ceil() — is the recommended approach.
We welcome PRs if you'd like to contribute this improvement! Based on your report, the ideal places to add this fix would be either in the Size.gibibytes method or on the EBS volume construct itself, just before synthesis.
Thanks again for helping us improve the AWS CDK developer experience!
Describe the bug
When creating an EBS volume using
ServiceManagedVolume
, floating-point values for thesize
parameter are not automatically rounded, leading to CloudFormation deployment/validation failures that are difficult to debug. I believe the issue occurs because CloudFormation expects integer values forSizeInGiB
, but floating-point numbers in the synthesized YAML are interpreted as strings.The root cause here seemed to be that CDK generated a config value
SizeInGiB: 193.60000000000002
which the API model expected to be a number but the193.60000000000002
value was treated as a string. Can this be an error or warning at build time instead?Workaround
Manually wrap the size calculation in
Math.ceil
:Additional Context
Regression Issue
Last Known Working CDK Version
No response
Expected Behavior
Math.ceil
Current Behavior
cfn-lint
Error Message During Deployment
Reproduction Steps
ServiceManagedVolume
with a calculated size that results in a floating-point number:Generated CloudFormation
Possible Solution
No response
Additional Information/Context
No response
CDK CLI Version
2.1007.0
Framework Version
2.139.0
Node.js Version
NodeJS 18
OS
Linux
Language
TypeScript
Language Version
No response
Other information
No response
The text was updated successfully, but these errors were encountered: