Skip to content

Commit

Permalink
Using the generated table name
Browse files Browse the repository at this point in the history
  • Loading branch information
jayair committed Sep 19, 2018
1 parent ee06a29 commit acfd7e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
3 changes: 1 addition & 2 deletions resources/dynamodb-table.yml
Expand Up @@ -2,8 +2,7 @@ Resources:
NotesTable:
Type: AWS::DynamoDB::Table
Properties:
# Generate a name based on the stage
TableName: ${self:custom.stage}-notes
TableName: ${self:custom.tableName}
AttributeDefinitions:
- AttributeName: userId
AttributeType: S
Expand Down
5 changes: 3 additions & 2 deletions serverless.yml
Expand Up @@ -9,6 +9,8 @@ custom:
# Our stage is based on what is passed in when running serverless
# commands. Or fallsback to what we have set in the provider section.
stage: ${opt:stage, self:provider.stage}
# Set the table name here so we can use it while testing locally
tableName: ${self:custom.stage}-notes
# Set our DynamoDB throughput for prod and all other non-prod stages.
tableThroughputs:
prod: 5
Expand All @@ -31,8 +33,7 @@ provider:
# These environment variables are made available to our functions
# under process.env.
environment:
tableName:
Ref: NotesTable
tableName: ${self:custom.tableName}
stripeSecretKey: ${self:custom.environment.stripeSecretKey}

iamRoleStatements:
Expand Down

0 comments on commit acfd7e8

Please sign in to comment.