Skip to content

Instantly share code, notes, and snippets.

@codepreneur
Last active October 24, 2016 08:54
Show Gist options
  • Save codepreneur/690a2f4b07af9ffc73f242855d4b749a to your computer and use it in GitHub Desktop.
Save codepreneur/690a2f4b07af9ffc73f242855d4b749a to your computer and use it in GitHub Desktop.
serverless framework/cli configuration file
service: "sadiavasio"
provider: "aws"
functions:
sadiavas:
handler: "index.graphql"
include:
- blog/
events:
- http:
path: "blog/graphql"
method: "POST"
custom:
excludePatterns: []
optimize:
exclude:
- "aws-sdk"
transforms:
-
name: "babelify"
opts:
presets:
- "es2015"
defaults:
stage: "dev"
region: "us-west-2"
memory: 1024
timeout: 6
resources:
Resources:
PostsDynamo:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: "Retain"
Properties:
AttributeDefinitions:
-
AttributeName: "id"
AttributeType: "S"
KeySchema:
-
AttributeName: "id"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: "${service}-posts-${stage}"
AuthorsDynamo:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: "Retain"
Properties:
AttributeDefinitions:
-
AttributeName: "id"
AttributeType: "S"
KeySchema:
-
AttributeName: "id"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: "${service}-authors-${stage}"
CommentsDynamo:
Type: "AWS::DynamoDB::Table"
DeletionPolicy: "Retain"
Properties:
AttributeDefinitions:
-
AttributeName: "id"
AttributeType: "S"
KeySchema:
-
AttributeName: "id"
KeyType: "HASH"
ProvisionedThroughput:
ReadCapacityUnits: 1
WriteCapacityUnits: 1
TableName: "${service}-comments-${stage}"
@jetheurer
Copy link

jetheurer commented Sep 8, 2016

I get the following error when using this template:

Invalid variable reference syntax for variable stage.
     You can only reference env vars, options, & files. You
     can check our docs for more info.

I believe its related to the line TableName: "${service}-comments-${stage}"

I think it should be ${self:service}-comments-${opt:stage} with the 1.0.0-rc.1 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment