Need to create a step function with above state machine workflow using terraform.

-2

Need to create a step function with above state machine workflows using terraform. using terraform.

질문됨 일 년 전1246회 조회
1개 답변
1

AWS Step Functions orchestrate a state machine workflow. State machine workflows are defined using Amazon States Language.

Terraform exposes the underlying AWS public API for Step Functions through the aws_sfn_state_machine and aws_sfn_activity resource types. For example code, the Terraform registry has resource documentation and examples.

It is important to note that for state machines, the definition of the workflow is in the Amazon States Language, a JSON-based, structured language used to define your state machine, a collection of states, that can do work (Task states), determine which states to transition to next (Choice states), stop an execution with an error (Fail states), and so on.

This means that any workflow example in JSON will work, regardless if you find it for CloudFormation, AWS CLI, or Terraform.

Terraform documentation for Step Functions

https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/sfn_state_machine

Sample projects for Step Functions

https://docs.aws.amazon.com/step-functions/latest/dg/create-sample-projects.html


Here is a basic example from the Terraform documentation:

resource "aws_sfn_state_machine" "sfn_state_machine" {
  name     = "my-state-machine"
  role_arn = aws_iam_role.iam_for_sfn.arn

  definition = <<EOF
{
  "Comment": "A Hello World example of the Amazon States Language using an AWS Lambda Function",
  "StartAt": "HelloWorld",
  "States": {
    "HelloWorld": {
      "Type": "Task",
      "Resource": "${aws_lambda_function.lambda.arn}",
      "End": true
    }
  }
}
EOF
}
profile pictureAWS
답변함 일 년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠