https://www.terraform.io/intro/ by https://hashicorp.com/ is one of the most popular infrastructure-as-code (IaC) platforms. In this blog, we showcase best practices for users leveraging Terraform to deploy workflows, also known as Step Functions state machines. We will create a state machine using https://docs.aws.amazon.com/step-functions/latest/dg/workflow-studio.html for AWS Step Functions, deploy the state machine with Terraform, and introduce best operating practices on topics such as project structure, modules, parameter substitution, and remote state.

Before moving forward, let’s analyze the directory, subdirectories, and files created above: /statemachine will hold our https://docs.aws.amazon.com/step-functions/latest/dg/concepts-amazon-states-language.html (ASL) JSON code describing the Step Functions state machine definition.

# Create an IAM policy for the Step Functions state machine resource "aws_iam_role_policy""StateMachinePolicy"{ role = aws_iam_role.StateMachineRole.id policy = data.aws_iam_policy_document.state_machine_role_policy.json }

Related Articles