-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstep.tf
53 lines (49 loc) · 1.01 KB
/
step.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
48
49
50
51
52
53
resource "aws_iam_role" "step_functions_role" {
name = "step_functions_execution_role"
assume_role_policy = jsonencode({
Version = "2012-10-17"
Statement = [
{
Effect = "Allow"
Principal = {
Service = "states.amazonaws.com"
}
Action = "sts:AssumeRole"
},
]
})
}
resource "aws_iam_role_policy" "step_functions_policy" {
role = aws_iam_role.step_functions_role.id
policy = <<POLICY
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"lambda:InvokeFunction"
],
"Resource": "*"
}
]
}
POLICY
}
resource "aws_sfn_state_machine" "aurora_workflow" {
name = "AuroraWorkflow"
role_arn = aws_iam_role.step_functions_role.arn
definition = <<EOF
{
"Comment": "A workflow to process Aurora data",
"StartAt": "FetchAuroraData",
"States": {
"FetchAuroraData": {
"Type": "Task",
"Resource": "${aws_lambda_function.retrieve_data.arn}",
"End": true
}
}
}
EOF
}