Skip to content

Commit

Permalink
Merge pull request #81 from FloRul/email-receipt-sender
Browse files Browse the repository at this point in the history
Email receipt sender
  • Loading branch information
joelbalcaen authored Mar 25, 2024
2 parents ab048e4 + 6c43b22 commit 27d3483
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 5 deletions.
15 changes: 10 additions & 5 deletions lambdas/email_receipt_confirmation/lambda.tf
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
locals {
lambda_function_name = "email-receipt-confirmation-dev"
ses_arn = "arn:aws:ses:us-east-1:446872271111:identity/lab.levio.cloud"
ses_arn = "arn:aws:ses:${var.aws_region}:${data.aws_caller_identity.current.account_id}/lab.levio.cloud/*:*"
timeout = 30
runtime = "python3.11"
powertools_layer_arn = "arn:aws:lambda:${var.aws_region}:017000801446:layer:AWSLambdaPowertoolsPythonV2:67"
Expand All @@ -25,10 +25,6 @@ module "lambda_function_container_image" {
role_name = "${local.lambda_function_name}-role"
attach_policy_statements = true

environment_variables = {
RECEIPT_REPLY_TEXT = ""
}

policy_statements = {
log_group = {
effect = "Allow"
Expand Down Expand Up @@ -57,6 +53,15 @@ module "lambda_function_container_image" {
effect = "Allow"
resources = [local.ses_arn]
actions = ["ses:SendEmail"]
}
}


allowed_triggers = {
ses = {
principal = "ses.amazonaws.com"
source_arn = "arn:aws:ses:${var.aws_region}:${data.aws_caller_identity.current.account_id}:receipt-rule-set/${var.rule_set_name}:receipt-rule/${var.chat_rule_name}"
}
}

}
11 changes: 11 additions & 0 deletions lambdas/email_receipt_confirmation/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,14 @@ variable "aws_region" {
type = string
nullable = false
}


variable "rule_set_name" {
type = string
nullable = false
}

variable "chat_rule_name" {
type = string
nullable = false
}
2 changes: 2 additions & 0 deletions terraform/modules.tf
Original file line number Diff line number Diff line change
Expand Up @@ -223,4 +223,6 @@ module "email_receipt_confirmation" {
source = "../lambdas/email_receipt_confirmation"
lambda_storage_bucket = aws_s3_bucket.lambda_storage.id
aws_region = var.aws_region
rule_set_name = local.rule_set_name
chat_rule_name = local.chat_rule_name
}

0 comments on commit 27d3483

Please sign in to comment.