data "aws_iam_policy_document" "step_functions_deployment_policy" {
  statement {
    sid    = "AllowStateMachineDeployment"
    effect = "Allow"
    actions = [
      "states:ListStateMachines",
      "states:ListActivities",
      "states:CreateStateMachine",
      "states:CreateActivity",
      "states:UpdateStateMachine",
      "states:DescribeStateMachine",
      "states:ListTagsForResource",
      "states:TagResource",
      "states:UntagResource",
      "states:StopExecution",
    ]
    resources = ["*"]
  }
}

resource "aws_iam_policy" "step_functions_deployment_policy" {
  name        = "${var.name_prefix}-step_functions_deploy_policy"
  path        = "/"
  description = "Allows step functions deployment"
  policy      = data.aws_iam_policy_document.step_functions_deployment_policy.json
}
