Skip to content

Commit 7b9c728

Browse files
72636cDmitry ShirokovToby Heighway
authored
Use new serverless.yml#/provider/iam grouping (#357)
Co-authored-by: Dmitry Shirokov <[email protected]> Co-authored-by: Toby Heighway <[email protected]>
1 parent 18aa0d7 commit 7b9c728

File tree

3 files changed

+25
-16
lines changed

3 files changed

+25
-16
lines changed

.changeset/brave-taxis-prove.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
'skuba': patch
3+
---
4+
5+
**template/lambda-sqs-worker:** Use new `serverless.yml#/provider/iam` grouping
6+
7+
The `provider.iamRoleStatements` property [will be removed in Serverless v3](https://github.com/serverless/serverless/blob/v2.25.1/docs/deprecations.md#grouping-iam-settings-under-provideriam).

template/lambda-sqs-worker/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
"@types/node": "^14.14.22",
1414
"chance": "^1.1.7",
1515
"pino-pretty": "^4.3.0",
16-
"serverless": "^2.20.1",
16+
"serverless": "^2.25.1",
1717
"serverless-plugin-canary-deployments": "^0.5.0",
1818
"serverless-prune-plugin": "^1.4.3",
1919
"skuba": "*"

template/lambda-sqs-worker/serverless.yml

+17-15
Original file line numberDiff line numberDiff line change
@@ -31,21 +31,23 @@ provider:
3131
# Use a shared account-level bucket for Lambda bundles and other artefacts.
3232
# This is easier to manage in terms of access, deployment, and tagging.
3333
name: ${self:custom.env.deploymentBucket}
34-
iamRoleStatements:
35-
- Action:
36-
- kms:Decrypt
37-
- kms:GenerateDataKey*
38-
Effect: Allow
39-
Resource: !GetAtt EncryptionKey.Arn
40-
- Action: lambda:InvokeFunction
41-
Effect: Allow
42-
Resource: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${self:functions.Worker.name}
43-
- Action: sns:Publish
44-
Effect: Allow
45-
Resource: !Ref DestinationTopic
46-
- Action: sqs:SendMessage*
47-
Effect: Allow
48-
Resource: !GetAtt DeadLetterQueue.Arn
34+
iam:
35+
role:
36+
statements:
37+
- Action:
38+
- kms:Decrypt
39+
- kms:GenerateDataKey*
40+
Effect: Allow
41+
Resource: !GetAtt EncryptionKey.Arn
42+
- Action: lambda:InvokeFunction
43+
Effect: Allow
44+
Resource: !Sub arn:aws:lambda:${AWS::Region}:${AWS::AccountId}:function:${self:functions.Worker.name}
45+
- Action: sns:Publish
46+
Effect: Allow
47+
Resource: !Ref DestinationTopic
48+
- Action: sqs:SendMessage*
49+
Effect: Allow
50+
Resource: !GetAtt DeadLetterQueue.Arn
4951
stackTags:
5052
# TODO: add data classification tags
5153
# https://rfc.skinfra.xyz/RFC019-AWS-Tagging-Standard.html#seekdataconsumers

0 commit comments

Comments
 (0)