Skip to content

Commit

Permalink
Making deployment more generic to be able to deploy to multiple stages.
Browse files Browse the repository at this point in the history
  • Loading branch information
onema committed Jan 21, 2019
1 parent 0addc35 commit 6512da0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 17 deletions.
4 changes: 2 additions & 2 deletions infrastructure/global-values.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ iamRoleStatements:
- dynamodb:GetItem
- dynamodb:Query
Resource:
- Fn::GetAtt: [ DynamoDBTable, Arn ]
- Fn::Join: ["/", [ Fn::GetAtt: [DynamoDBTable, Arn], "index", "*"]]
- Fn::GetAtt: [ LambdaMailerTable, Arn ]
- Fn::Join: ["/", [ Fn::GetAtt: [LambdaMailerTable, Arn], "index", "*"]]
- Effect: Allow
Action:
- ses:SendEmail
Expand Down
15 changes: 4 additions & 11 deletions infrastructure/mailer-resources_cfn.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
Parameters:
TableName:
Type: String
Default: LambdaMailerSESNotifications
Description: The name of the dynamodb table
PartitionKey:
Type: String
Default: MessageId
Expand Down Expand Up @@ -30,12 +26,9 @@ Parameters:

Resources:

DynamoDBTable:
LambdaMailerTable:
Type: AWS::DynamoDB::Table
Properties:
TableName:
Ref: TableName

AttributeDefinitions:
- AttributeName:
Ref: PartitionKey
Expand Down Expand Up @@ -109,21 +102,21 @@ Resources:
Outputs:
LambdaMailerTopicArn:
Value:
Ref: SNSTopicDevmailer
Ref: SNSTopicMailer
Export:
Name:
Fn::Join: ["-", [Ref: StageName, "lambda-mailer-topic-arn"]]

LambdaMailerBounceTopicArn:
Value:
Ref: SNSTopicDevmailerbounce
Ref: SNSTopicMailerbounce
Export:
Name:
Fn::Join: ["-", [Ref: StageName, "lambda-mailer-bounce-topic-arn"]]

EmailBounceAndComplaintTable:
Value:
Ref: DynamoDBTable
Ref: LambdaMailerTable

ForwarderS3BucketArn:
Value:
Expand Down
8 changes: 4 additions & 4 deletions serverless.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,19 +44,19 @@ functions:
onError: ${file(infrastructure/global-values.yml):deadLetterQueue}
environment:
TABLE_NAME:
Ref: TableName
Ref: LambdaMailerTable
events:
- sns: ${self:custom.stageName}-mailer-bounce
- sns: mailer-bounce

mailer:
handler: io.onema.mailer.MailerFunction::lambdaHandler
onError: ${file(infrastructure/global-values.yml):deadLetterQueue}
environment:
LOG_EMAIL: ${env:LOG_EMAIL, 'false'}
TABLE_NAME:
Ref: TableName
Ref: LambdaMailerTable
events:
- sns: ${self:custom.stageName}-mailer
- sns: mailer

forwarder:
handler: io.onema.forwarder.ForwarderFunction::lambdaHandler
Expand Down

0 comments on commit 6512da0

Please sign in to comment.