[cfn-include] Ref'd Parameters
in Conditions
are not replaced when parameters
are set to ""
#10107
Labels
@aws-cdk/cloudformation-include
Issues related to the "CFN include v.20" package
bug
This issue is a bug.
effort/small
Small work item – less than a day of effort
in-progress
This issue is being actively worked on.
p2
Milestone
I have a CloudFormation template which has both
Parameters
andConditions
. TheConditions
Ref
theParameters
. When I set theparameters
field on the props while instantiating a CfnInclude construct, and then runcdk synth
(ordeploy
ordiff
), I see an exception if I set the value of the parameter to the empty string.If the parameter is named
SomeParameter
, The error message reads:Reproduction Steps
Bug.json
- A cfn template with a parameter and conditionA CfnInclude construct to add to a stack
What did you expect to happen?
I'd expect to see the value
""
replaced wherever aRef
points toSomeParameter
. This works as expected with a non-empty string value.What actually happened?
The
cdk synth
command failed producing the following error:Environment
Other
I did some digging and I'm fairly sure that the issue lies here:
https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/core/lib/cfn-parse.ts#L435
and is a result of the value returned from
this.specialCaseRefs
here:https://github.com/aws/aws-cdk/blob/master/packages/%40aws-cdk/core/lib/cfn-parse.ts#L651-L666
this.specialCaseRefs
appears to have 3 classes of return value:AWS::*
flagif the value of the parameter is falsey (such as an empty string) then the returned value will be seen as NOT a
specialRef
and will not be replaced.I think the fix is simple, but I haven't tested it. Will try to open a PR if possible. The fix should just be:
This is 🐛 Bug Report
The text was updated successfully, but these errors were encountered: