7
votes

I'm attempting to create a CloudFormation stack and am getting the following error:

A client error (ValidationError) occurred when calling the CreateStack operation: Template error: every Ref object must have a single String value.

However, when I grep the template looking for Ref objects they are all Strings except for a single lookup which looks like

{
  "Ref": {
     "Fn::FindInMap": [
         "InfraMap",
         "SecurityGroups",
         "NATSecurityGroup"
     ]
  }
}

The value for this reference is "NATSecurityGroup": "sg-54e6be30", which seems OK to me.

Any other thoughts on what this error could be referring to?

1

1 Answers

13
votes
"Ref": {
     "Fn::FindInMap": [
         "InfraMap",
         "SecurityGroups",
         "NATSecurityGroup"
     ]
}

This is not correct, the Ref is not required in this case, where the value it is referencing is a constant and not a variable created during the creation of the stack.

Replacing it with

"Fn::FindInMap": [
     "InfraMap",
     "SecurityGroups",
     "NATSecurityGroup"
]

Resolves the issue.