title: How do I define resources for iamrolestatements for multiple dynamodb tables in serverless framework?
body: <p>I want to use more than one dynamodb table in my serverless project. How do I properly define multiple resources in the iamrolestatements?</p>
  
  <p>I have an example <code>serverless.yml</code> </p>
  
  <pre><code>service: serverless-expense-tracker
  frameworkVersion: "&gt;=1.1.0 &lt;2.0.0"
  
  provider:
    name: aws
    runtime: nodejs6.10
    environment:
      EXPENSES_TABLE: "${self:service}-${opt:stage, self:provider.stage}-expenses"
      BUDGETS_TABLE: "${self:service}-${opt:stage, self:provider.stage}-budgets"
  
    iamRoleStatements:
      - Effect: Allow
        Action:
          - dynamodb:Query
          - dynamodb:Scan
          - dynamodb:GetItem
          - dynamodb:PutItem
          - dynamodb:UpdateItem
          - dynamodb:DeleteItem
        Resource: "arn:aws:dynamodb:${opt:region, self:provider.region}:*:table/${self:provider.environment.EXPENSES_TABLE}"
        # what is the best way to add the other DB as a resource
  
  functions:
    create:
      handler: expenseTracker/create.create
      events:
        - http:
            path: expenses
            method: post
            cors: true
  
    list:
      handler: expenseTracker/list.list
      events:
        - http:
            path: expenses
            method: get
            cors: true
  
    get:
      handler: expenseTracker/get.get
      events:
        - http:
            path: expenses/{id}
            method: get
            cors: true
  
    update:
      handler: expenseTracker/update.update
      events:
        - http:
            path: expenses/{id}
            method: put
            cors: true
  
    delete:
      handler: expenseTracker/delete.delete
      events:
        - http:
            path: expenses/{id}
            method: delete
            cors: true
  
  resources:
    Resources:
      DynamoDbExpenses:
        Type: 'AWS::DynamoDB::Table'
        DeletionPolicy: Retain
        Properties:
          AttributeDefinitions:
            -
              AttributeName: id
              AttributeType: S
          KeySchema:
            -
              AttributeName: id
              KeyType: HASH
          ProvisionedThroughput:
            ReadCapacityUnits: 1
            WriteCapacityUnits: 1
          TableName: ${self:provider.environment.EXPENSES_TABLE}
  
      DynamoDbBudgets:
        Type: 'AWS::DynamoDB::Table'
        DeletionPolicy: Retain
        Properties:
          AttributeDefinitions:
            -
              AttributeName: id
              AttributeType: S
          KeySchema:
            -
              AttributeName: id
              KeyType: HASH
          ProvisionedThroughput:
            ReadCapacityUnits: 1
            WriteCapacityUnits: 1
          TableName: ${self:provider.environment.BUDGETS_TABLE}
  </code></pre>
  
  <p>You can see the area in question in the comments there.</p>