Skip to content

Commit 09dd725

Browse files
authored
Merge pull request #113 from silinternational/develop
Release 2.4.0
2 parents 5c220d0 + b4c5f93 commit 09dd725

File tree

2 files changed

+81
-5
lines changed

2 files changed

+81
-5
lines changed

serverless.yml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ provider:
2828
- dynamodb:PutItem
2929
- dynamodb:UpdateItem
3030
- dynamodb:DeleteItem
31-
Resource: "arn:aws:dynamodb:${aws:region}:*:table/${self:custom.namespace}_*"
31+
Resource: "arn:aws:dynamodb:*:*:table/${self:custom.namespace}_*"
3232

3333
custom:
3434
namespace: ${self:service}_${sls:stage}
@@ -37,6 +37,7 @@ custom:
3737
u2fTable: ${self:custom.namespace}_u2f
3838
dev_env: staging
3939
prod_env: production
40+
secondaryRegion: ${env:AWS_REGION_SECONDARY, "us-west-2"}
4041

4142
functions:
4243
apiKeyActivate:
@@ -192,6 +193,41 @@ functions:
192193

193194
resources:
194195
Resources:
196+
ApiKeyDynamoDbGlobalTable:
197+
Type: AWS::DynamoDB::GlobalTable
198+
DeletionPolicy: Retain
199+
Properties:
200+
AttributeDefinitions:
201+
- AttributeName: value
202+
AttributeType: S
203+
KeySchema:
204+
- AttributeName: value
205+
KeyType: HASH
206+
BillingMode: PAY_PER_REQUEST
207+
Replicas:
208+
- Region: ${aws:region}
209+
Tags:
210+
- Key: "itse_app_name"
211+
Value: ${self:service}
212+
- Key: "itse_app_env"
213+
Value: ${self:custom.${sls:stage}_env}
214+
- Key: "itse_app_customer"
215+
Value: "shared"
216+
- Key: "managed_by"
217+
Value: "serverless"
218+
- Region: ${self:custom.secondaryRegion}
219+
Tags:
220+
- Key: "itse_app_name"
221+
Value: ${self:service}
222+
- Key: "itse_app_env"
223+
Value: ${self:custom.${sls:stage}_env}
224+
- Key: "itse_app_customer"
225+
Value: "shared"
226+
- Key: "managed_by"
227+
Value: "serverless"
228+
StreamSpecification:
229+
StreamViewType: NEW_IMAGE
230+
TableName: ${self:custom.apiKeyTable}_global
195231
ApiKeyDynamoDbTable:
196232
Type: AWS::DynamoDB::Table
197233
DeletionPolicy: Retain

terraform/main.tf

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,51 @@ module "serverless-user" {
1717
{
1818
"Effect" : "Allow",
1919
"Action" : [
20-
"dynamodb:DescribeTable"
20+
"dynamodb:DescribeGlobalTableSettings",
21+
"dynamodb:DescribeGlobalTable"
2122
],
22-
"Resource" : [
23-
"arn:aws:dynamodb:*:*:table/mfa-api_*"
24-
]
23+
"Resource" : "arn:aws:dynamodb:*:*:global-table/mfa-api_*"
24+
},
25+
{
26+
"Effect" : "Allow",
27+
"Action" : [
28+
"dynamodb:BatchWriteItem",
29+
"dynamodb:CreateTable",
30+
"dynamodb:CreateTableReplica",
31+
"dynamodb:DeleteItem",
32+
"dynamodb:DescribeContinuousBackups",
33+
"dynamodb:DescribeContributorInsights",
34+
"dynamodb:DescribeKinesisStreamingDestination",
35+
"dynamodb:DescribeTable",
36+
"dynamodb:DescribeTimeToLive",
37+
"dynamodb:GetItem",
38+
"dynamodb:ListTagsOfResource",
39+
"dynamodb:PutItem",
40+
"dynamodb:Query",
41+
"dynamodb:Scan",
42+
"dynamodb:TagResource",
43+
"dynamodb:UntagResource",
44+
"dynamodb:UpdateItem",
45+
"dynamodb:UpdateTable"
46+
],
47+
"Resource" : "arn:aws:dynamodb:*:*:table/mfa-api_*"
48+
},
49+
{
50+
"Effect" : "Allow",
51+
"Action" : [
52+
"dynamodb:Scan",
53+
"dynamodb:Query"
54+
],
55+
"Resource" : "arn:aws:dynamodb:*:*:table/mfa-api_*/index/*"
56+
},
57+
{
58+
"Effect" : "Allow",
59+
"Action" : [
60+
"iam:CreateServiceLinkedRole",
61+
"iam:TagRole",
62+
"iam:UntagRole"
63+
],
64+
"Resource" : "arn:aws:iam::*:role/*"
2565
}
2666
]
2767
}

0 commit comments

Comments
 (0)