-
Notifications
You must be signed in to change notification settings - Fork 1
/
3_polymorphic_lambda.tf
47 lines (44 loc) · 1.11 KB
/
3_polymorphic_lambda.tf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
resource "aws_sfn_state_machine" "poly_state_machine" {
name = "poly-step-function"
role_arn = aws_iam_role.simple_step_function_role.arn
definition = <<EOF
{
"Comment": "Polymorphic example",
"StartAt": "CallLambda",
"States": {
"CallLambda":{
"Type":"Task",
"Resource":"arn:aws:states:::lambda:invoke",
"Parameters":{
"FunctionName":"${aws_lambda_function.poly_function.function_name}",
"Qualifier.$": "$.client"
},
"End":true
}
}
}
EOF
}
data "archive_file" "poly_1" {
type = "zip"
output_path = "/tmp/poly1.zip"
source {
content = <<EOF
def test(event, context):
print("Test called")
event["apples"] = "1"
return event
EOF
filename = "main.py"
}
}
# Check readme
resource "aws_lambda_function" "poly_function" {
function_name = "poly-step-function-step"
role = aws_iam_role.iam_for_lambda.arn
handler = "main.test"
runtime = "python3.9"
filename = data.archive_file.poly_1.output_path
source_code_hash = data.archive_file.poly_1.output_base64sha256
publish = true
}