Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Malformed input-Template format error: Every Default member must be a string (Cloudformation template problems)

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.

like image 747
mhalligan Avatar asked Mar 19 '15 18:03

mhalligan


3 Answers

This problem occurs when you specify Parameters 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.

like image 75
Guss Avatar answered Oct 14 '22 22:10

Guss


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.

like image 42
Shazic Avatar answered Oct 14 '22 22:10

Shazic


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.

like image 26
Nathan Hanna Avatar answered Oct 14 '22 23:10

Nathan Hanna