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?
To check your template file for syntax errors, you can use the aws cloudformation validate-template command. The aws cloudformation validate-template command is designed to check only the syntax of your template.
Validate template syntaxCreate your stack with AWS CloudFormation Designer. Validate your JSON syntax with a text editor, or a command line tool such as the AWS CLI template validator. Validate your YAML syntax with the aws cloudformation validate-template command.
AWS CloudFormation is a service that gives developers and businesses an easy way to create a collection of related AWS and third-party resources, and provision and manage them in an orderly and predictable fashion.
"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.
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