Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bug: cannot deploy stepfunctions using terraform aws provider 5.11.0 #8855

Closed
@steffyP

Description

@steffyP

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Using the latest aws provider 5.11.0 for deploying a terraform script with terraform-aws-modules/step-functions/aws fails because the operation ListStateMachineVersions is not implemented.

The default stepfunctions provider is using the official stepfunctions-lib, which currently doesn't seem to support this operation either (tested with version 1.12.3):

Step Functions Local
Version: 1.12.3
Build: 2023-08-01

Testing directly with this image results in the same outcome:

$ docker run -p 8083:8083 amazon/aws-stepfunctions-local

$ state_machine_arn=$(aws stepfunctions --endpoint-url http://localhost:8083/ create-state-machine --definition "{\
  \"Comment\": \"A Hello World example of the Amazon States Language using a Pass state\",\
  \"StartAt\": \"HelloWorld\",\
  \"States\": {\
    \"HelloWorld\": {\
      \"Type\": \"Pass\",\
      \"End\": true\
    }\
  }}" --name "HelloWorld" --role-arn "arn:aws:iam::012345678901:role/DummyRole" | jq -r .stateMachineArn)

$ aws  stepfunctions --endpoint-url http://localhost:8083/ list-state-machine-versions --state-machine-arn $state_machine_arn

An error occurred (UnsupportedOperation) when calling the ListStateMachineVersions operation (reached max retries: 2): Unsupported Operation: 'ListStateMachineVersions'

Expected Behavior

The new stepfunctions provider (v2) should support this operation ListStateMachineVersions, the terraform deployment should work without any issues.

How are you starting LocalStack?

With a docker-compose file

Steps To Reproduce

main.tf

resource aws_sns_topic "sns_sqs_jit" {
  name = "sns_sqs_jit"
  display_name = "sns_sqs_jit"
}

data "aws_caller_identity" "current" {}

module "step_function" {
  source      = "terraform-aws-modules/step-functions/aws"
  name        = "jit-scheduled-step-function-dev"
  create_role = false
  use_existing_role = true
  role_arn = "arn:aws:iam::${data.aws_caller_identity.current.account_id}:role/service-role/StatesExecutionRole-us-east-1"
  definition = <<EOF
{
  "Comment": "State machine for scheduled events",
  "StartAt": "Wait",
  "States": {
    "Wait": {
      "Type": "Wait",
      "TimestampPath": "$.scheduledTimestamp",
      "Next": "SNS Publish"
    },
    "SNS Publish": {
      "Type": "Task",
      "Resource": "arn:aws:states:::sns:publish",
      "Parameters": {
        "TopicArn": "${aws_sns_topic.sns_sqs_jit.arn}",
        "Message": {
          "Message.$": "$.Message"
        },
        "MessageAttributes": {
            "event_type": {
              "DataType": "String",
              "StringValue": "READY_FOR_ACTIVATION"
            }
          }
      },
      "End": true
    }
  }
}
EOF
}

Client commands

tflocal init
tflocal apply

Environment

- OS: MacOS
- LocalStack: latest

Anything else?

Workaround

Pinning the aws-provider to version <=5.10.0

provider "aws" {
  version = "<= 5.10.0"
}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions