For anyone working with YAML Cloud Formation, if you were to see this error message:
E0001 Error transforming template: 'NoneType' object has no attribute 'get'
cloudformation.yaml:1:1
it might be because one of your resources is not properly indented. That is, the Type
and Properties
keyword is at the same indentation level as the resource name:
Resources:
# Broken
DeadLetterQueue:
Type: AWS::SQS::Queue
Properties:
# ...
# Fixed
DeadLetterQueue:
Type: AWS::SQS::Queue
Properties:
# ...
Another problem is that you’re trying to use !GetAtt
with a string parameter:
Parameters:
DynamoDBStream:
Type: String
Resources:
LambdaDynamoStream:
Type: AWS::Lambda::EventSourceMapping
Properties:
# This is the source of your woes
EventSourceArn: !GetAtt DynamoDBStream.StreamArn
Took a while for me to find the cause of these. Had to comment out all the resources and uncomment them back one by one. In retrospect, a quick glance at the entire file would’ve found it as well; although the slow act of going through the file, commenting and uncommenting things, was still a useful act in and of itself.
Naturally the error message is cryptic, probably because it falls within the gap of a well-formed YAML file but a badly formed object model. Some better error reporting would be preferred though.
And yeah, there’s going to be commentary about error reporting in these posts. 😛