Skip to content

Conversation

@mvayngrib
Copy link

first off, thanks a bunch for this plugin, i've been using it for a while now and haven't had any issues!

I'm not sure if you're interested in merging this, as it has breaking changes (tests pass but serverless.yml configuration changed a bit). Still, maybe it'll be useful to some of the other folks who wanted to use one IAM role instead of many. For reference, the conf and role I use look like this:

serverless.yml:

custom:
  dynamodb-autoscaling:
    role: AutoScalingDynamoDBRole
    capacities:
      # same as before
      - table: InboxTable
        index:
          - context

resources:
  Resources:
    AutoScalingDynamoDBRole:
      Type: AWS::IAM::Role
      Properties:
        AssumeRolePolicyDocument:
          Version: '2012-10-17'
          Statement:
            - Effect: Allow
              Principal:
                Service:
                  - application-autoscaling.amazonaws.com
              Action:
                - sts:AssumeRole
        Path: "/"
        Policies:
          - PolicyName: AutoScalingDynamoDBPolicy
            PolicyDocument:
              Version: '2012-10-17'
              Statement:
                - Effect: Allow
                  Action:
                    - dynamodb:DescribeTable
                    - dynamodb:UpdateTable
                  Resource:
                    - Fn::Join:
                        - ""
                        - - "arn:aws:dynamodb:"
                          - Ref: AWS::Region
                          - ":*:table/${{self:custom.prefix}}*" # tables and indexes
                - Effect: Allow
                  Action:
                    - cloudwatch:DescribeAlarms
                    - cloudwatch:PutMetricAlarm
                    - cloudwatch:DeleteAlarms
                  Resource: "*"

the custom.prefix var is ${{self:service}}-${{self:provider.stage}}-

it's not the cleanest PR, as I saw the chance to improve some of the typings :)

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant