Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support external role (breaking change) #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

None yet

1 participant