bsmsapp/terraform/organization/stepfunctions.tf

67 lines
1.3 KiB
HCL

module "stepfunctions" {
source = "../modules/stepfunctions"
providers = {
aws = aws.aws
}
name = "AWSStepFunctions-g3"
role_arn = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/LabRole"
definition = <<EOF
{
"StartAt": "GetFromMLApi",
"States": {
"GetFromMLApi": {
"Type": "Task",
"Resource": "${module.lambda["lambdaGET"].function_arn}",
"Next": "UpdateDynamoDB",
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"Next": "SendError"
}
]
},
"UpdateDynamoDB": {
"Type": "Task",
"Resource": "${module.lambda["lambdaUpdate"].function_arn}",
"Next": "SendEmail",
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"Next": "SendError"
}
]
},
"SendEmail": {
"Type": "Task",
"Resource": "${module.lambda["lambdaSNS"].function_arn}",
"End": true,
"Catch": [
{
"ErrorEquals": [
"States.ALL"
],
"Next": "SendError"
}
]
},
"SendError": {
"Type": "Task",
"Resource": "${module.lambda["lambdaError"].function_arn}",
"Next": "ErrorWorkflow"
},
"ErrorWorkflow": {
"Type": "Fail"
}
}
}
EOF
type = "standard"
}