AWS Step Functions State Machine

This page shows how to write Terraform and CloudFormation for Step Functions State Machine and write them securely.

aws_sfn_state_machine (Terraform)

The State Machine in Step Functions can be configured in Terraform with the resource name aws_sfn_state_machine. The following sections describe 2 examples of how to use the resource and its parameters.

Example Usage from GitHub
resource "aws_sfn_state_machine" "expressWithoutUsage" {
  name       = "my-state-machine"
  role_arn   = "arn:aws:lambda:us-east-1:123456789012:resource-id"
  type       = "EXPRESS"
  definition = <<EOF
resource "aws_sfn_state_machine" "claire_investigation" {
  name       = "claire_investigation"
  role_arn   = aws_iam_role.claire_state_machine_role.arn
  definition = data.template_file.claire_investigation_state_machine.rendered


Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).


Explanation in Terraform Registry

Provides a Step Function State Machine resource

AWS::StepFunctions::StateMachine (CloudFormation)

The StateMachine in StepFunctions can be configured in CloudFormation with the resource name AWS::StepFunctions::StateMachine. The following sections describe how to use the resource and its parameters.

Example Usage from GitHub

An example could not be found in GitHub.


Explanation in CloudFormation Registry

Provisions a state machine. A state machine consists of a collection of states that can do work (Task states), determine to which states to transition next (Choice states), stop an execution with an error (Fail states), and so on. State machines are specified using a JSON-based, structured language.

Frequently asked questions

What is AWS Step Functions State Machine?

AWS Step Functions State Machine is a resource for Step Functions of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Step Functions State Machine?

For Terraform, the gilyas/infracost and roguehedgehog/claire source code examples are useful. See the Terraform Example section for further details.