(core): CfnOutput does not validate export name during synthesis but can fail during deployment #28563
Labels
@aws-cdk/core
Related to core CDK functionality
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
p2
Describe the bug
It is possible to create a
CfnOutput
in the CDK that synthesizes without issue, but then fails to deploy due to an invalid export name.Expected Behavior
The
CfnOutput
exportName
property should be validated according to the cloud formation rules at synthesis time to catch this problem sooner in the process.Current Behavior
CDK synthesis works just fine, however during deployment Cloud Formation deployments will fail:
Reproduction Steps
Possible Solution
Validate the
exportName
field of theCfnOutput
constructor props during synthesis. Possibly via a regex similar to[A-Za-z\d\-\:]*
.Additional Information/Context
I filed this under bug even though there isn't anything technically "wrong" with the CDK code because as a user, I would expect the synthesis to fail if something that can be validated to conform to cloud formation rules can be validated at synthesis time (and indeed in this case it appears at least on the surface that it can be).
CDK CLI Version
2.114.1
Framework Version
No response
Node.js Version
18
OS
MacOS 14 + Amazon Linux 2 5.10
Language
TypeScript
Language Version
5
Other information
No response
The text was updated successfully, but these errors were encountered: