Skip to content

Commit

Permalink
put object lambda
Browse files Browse the repository at this point in the history
  • Loading branch information
joelbalcaen committed Apr 19, 2024
1 parent 47f719b commit a1a6b06
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 1 deletion.
27 changes: 27 additions & 0 deletions state_machines/email_form_fill/state_machine.tf
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ resource "aws_iam_role" "iam_for_sfn" {
"lambda:InvokeFunction"
],
"Resource": "*"
},
{
"Effect": "Allow",
"Action": [
"s3:PutObject"
],
"Resource": "arn:aws:s3:::*/*"
}
]
}
Expand All @@ -33,6 +40,26 @@ resource "aws_sfn_state_machine" "sfn_state_machine" {
"Comment": "A description of my state machine",
"StartAt": "Lambda Invoke",
"States": {
"Store Email Medata": {
"Type": "Task",
"Next": "Lambda Invoke",
"Parameters": {
"Body": {
"sender_email": "[email protected]",
"destination_email": "bla",
"prompts": [
{
"key": "A",
"prompt": "",
"answer": ""
}
]
},
"Bucket": "${var.workspace_bucket_name}",
"Key": "MyData"
},
"Resource": "arn:aws:states:::aws-sdk:s3:putObject"
},
"Lambda Invoke": {
"Type": "Task",
"Resource": "arn:aws:states:::lambda:invoke",
Expand Down
6 changes: 6 additions & 0 deletions state_machines/email_form_fill/variables.tf
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
variable "attachment_saver_lambda_name" {
type = string
nullable = false
}

variable "workspace_bucket_name" {
type = string
nullable = false

}
3 changes: 2 additions & 1 deletion terraform/modules.tf
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,14 @@ module "step_function_invoker" {
module "email_formfiller_state_machine" {
source = "../state_machines/email_form_fill"
attachment_saver_lambda_name = module.attachment_saver.lambda_function_name
workspace_bucket_name = module.s3_bucket.s3_bucket_arn
}


module "email_attachment_saver" {
source = "../lambdas/email_attachment_saver"
lambda_storage_bucket = aws_s3_bucket.lambda_storage.id
aws_region = var.aws_region
allowed_s3_resources = [module.s3_bucket.s3_bucket_arn]
allowed_s3_resources = [module.s3_bucket.s3_bucket_arn]
}

0 comments on commit a1a6b06

Please sign in to comment.