amazon-dynamodbpulumi

Dynamo Pulumi setup not accepting L list data type


I am attempting to set up a DynamoDB table via Pulumi and thought everything was fine after reviewing official documentation, however I am getting a warning message about my data type not being valid.

error: aws:dynamodb/table:Table resource 'table-name' has a problem: expected type to be one of ["S" "N" "B"], got L. Examine values at 'table-name.attributes'.

I am wanting to use a List data type to hold my array of values as I had seen through official docs.

Is there any reason why I would be getting a message like this? Is it a general issue, or could it be something specific/an arbitrary rule within my own pipeline I'm unaware of?

const tableName = `table-name`;
  const dynamoDbTable = new DynamoDBTable(tableName, {
    name: tableName,
    hashKey: "ID",
    attributes: [
      {
        name: "ID",
        type: "S",
      },
      ...
      {
        name: "RESULTS",
        type: "L"
      }
    ],
    ...
  });

Solution

  • Pulumi is used to create Infrastructure as Code (IaC). When creating DynamoDB tables, you never declare non-key attributes as DynamoDB is schemaless.

    As you only declare key attributes, they must conform to DynamoDB's rules that they should be a scalar data type of either String S, Number N or Binary B.

    This is why you get the exception. I assume RESULTS is not a key attribute, you should remove it from your table creation code.