I'm attempting to validate a cloudformation template, and cfn-validate returns a useless error of
"Malformed input-Template format error: Every Default member must be a string".
Does anybody have an idea on how to debug this? It would be awesome if cfn-
validate
would return errors or at least resource names when errors are given.
CloudformationTemplates are incredibly painful to debug.
This problem occurs when you specify Parameter
s and have their default value calculated in some way (usually be referencing other parameters).
This is definition is not valid - parameters' default values must be strictly strings that the command line tool can replace with other strings.
I received the same error message when using the Parameter of type CommaDelimitedList
in my cfn template.
LoadBalancerSubnets:
Description: List of subnets for the ApplicationLoadBalancer
Type: CommaDelimitedList
Default: [ "subnet-123456", "subnet-012345" ]
This was due to my mis-interpretation of the CommaDelimitedList
type. I thought it is actually a list but it turns out that the value should be a single String value in which the various elements should be separated by a comma.
So, I changed my template to look like this:
LoadBalancerSubnets:
Description: List of subnets for the ApplicationLoadBalancer
Type: CommaDelimitedList
Default: "subnet-123456,subnet-012345"
and this worked.
The error was a very generic one and there may be other scenarios as well in which the same error gets thrown.
However, I thought about sharing my experience with this error so it may help others who got stuck with the same problem.
I have seen this error for the Outputs
description field as well (I was using !Sub
). Had to remove !Sub
and just use plain text.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With