serverless-application-model icon indicating copy to clipboard operation
serverless-application-model copied to clipboard

AWS::Serverless::SimpleTable - Primary Key Type 'Number' creates table with 'String' Primary Key

Open jiravani opened this issue 9 years ago • 3 comments

This template creates a DynamoDB Table with a Primary Key of Type String instead of Number

MySimpleTable:
    Type: 'AWS::Serverless::SimpleTable'
    PrimaryKey:
      Name: id
      Type: Number
    ProvisionedThroughput:
      ReadCapacityUnits: 5
      WriteCapacityUnits: 5

Unless I am misreading the documentation (below), this isn't intended behavior.

screen shot 2017-04-11 at 17 09 26

https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#primary-key-object

jiravani avatar Apr 11 '17 23:04 jiravani

I'm having a similar issue and it seems like the PrimaryKey parameter is ignored entirely. I have it set to Name: button and it still creates pk as id

schallis avatar Jun 20 '17 22:06 schallis

PrimaryKey should be under properties:

MySimpleTable:
    Type: 'AWS::Serverless::SimpleTable'
    Properties:
      PrimaryKey:
        Name: button
        Type: Number

vikrambhatt avatar Jun 20 '17 23:06 vikrambhatt

I will update the spec to include Properties key in examples because many people are tripping over it.

sanathkr avatar Jun 28 '17 07:06 sanathkr