Template validation error: Invalid template resource property 'name'
Closed this issue · 6 comments
i create a stack
iam getting template validation error
that error is ->Template validation error: Invalid template resource property 'name'
my code is
{
"AWSTemplateFormatVersion": "2010-09-09",
"Description": "cf feb 2019",
"Resources": {
"ourvpc": {
"name": "AWS::EC2::VPC",
"Type": "Aws",
"Properties": {
"CidrBlock": "10.0.0.0/16",
"Tags": [
{
"Key": "awsvpc",
"Value": "overall"
}
]
}
}
}
}
replace name with Type and remove the Type key on your code.
follow this for creating vpc
"name": {
"Type": "AWS::EC2::VPC",
"Properties": {
"CidrBlock": "----/--",
"Tags": [-]
}
}
Is this issue resolved
I create this stack, have this problem : Template validation error: Invalid template resource property 'host'
{
"Resources": {
"Instancia1": {
"Type": "AWS::EC2::Instance",
"Properties": {
"ImageId":"ami-1b2fa465",
"KeyName": "key-AWS-Linux",
"InstanceType" : "t3.micro",
"SecurityGroupIds" : ["sg-0df50ddc8ae357dfc"]
},
"swagger": "2.0",
"info": {
"description": "Users API",
"version": "1.0.0",
"title": "Users"
},
"host": "api.users.es",
"basePath": "/users",
"schemes": [
"http",
"https"
],
"produces": [
"application/json"
],
"consumes": [
"application/json"
],
"paths": {
"/getusers": {
"get": {
"description": "Get all users",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/user"
}
}
}
}
}
},
"/createUsers": {
"post": {
"parameters": [
{
"in": "body",
"name": "user",
"schema": {
"$ref": "#/definitions/user"
},
"required": true
}
],
"responses": {
"201": {
"description": "CREATED",
"schema": {
"$ref": "#/definitions/user"
}
},
"405": {
"description": "Invalid input"
}
}
}
},
"/getusersById/{userId}": {
"get": {
"description": "Get one user",
"parameters": [
{
"in": "path",
"name": "userId",
"type": "integer",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/user"
}
},
"400": {
"description": "Invalid user id"
},
"404": {
"description": "User not found"
}
}
}
},
"/updateUsersById/{userId}": {
"put": {
"parameters": [
{
"in": "path",
"name": "userId",
"type": "integer",
"required": true
},
{
"in": "body",
"name": "user",
"schema": {
"$ref": "#/definitions/user"
},
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/user"
}
},
"400": {
"description": "Invalid user id"
},
"404": {
"description": "User not found"
}
}
}
},
"/deleteUsersById/{userId}": {
"delete": {
"parameters": [
{
"in": "path",
"name": "userId",
"type": "integer",
"required": true
}
],
"responses": {
"200": {
"description": "OK"
},
"400": {
"description": "Invalid user id"
},
"404": {
"description": "User not found"
}
}
}
}
},
"definitions": {
"user": {
"properties": {
"id": {
"type": "integer"
},
"name": {
"type": "string"
},
"email": {
"type": "string"
},
"birthDate": {
"type": "string",
"format": "LocalDateTime",
"description": "LocalDateTime type"
},
"address": {
"$ref": "#/definitions/address"
}
}
},
"address": {
"properties": {
"id": {
"type": "integer"
},
"street": {
"type": "string"
},
"state": {
"type": "string"
},
"city": {
"type": "string"
},
"country": {
"type": "string"
},
"zip": {
"type": "string"
}
}
}
}
}
}
}
Hi Bryan,
you have to strictly follow the syntax mentioned in https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-ec2-instance.html
I see some extra key elements. This will not be processed by amazon cloudformation
Hola, tengo el mismo problema, alguna solucione?