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

Skip to content

bug: PROVIDER_OVERRIDE_STEPFUNCTIONS=v2 - Getting InvalidDefinition: None for a valid state machine definition #9006

Closed
@kevle1

Description

@kevle1

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

I have the following state machine definition in Terraform that fails when using tflocal to deploy to Localstack.

resource "aws_sfn_state_machine" "test_sfn" {
  name     = "test-state-machine"
  role_arn = aws_iam_role.state_machine_role.arn

  definition = jsonencode({
    "StartAt": "CheckCondition",
    "States": {
      "CheckCondition": {
        "Type": "Task",
        "Resource": module.check.lambda_function_arn,
        "ResultPath": "$.result",
        "Next": "CheckResult"
      },
      "CheckResult": {
        "Type": "Choice",
        "Choices": [
          {
            "Variable": "$.result.done",
            "BooleanEquals": true,
            "Next": "Send"
          },
          {
            "Variable": "$.result.done",
            "BooleanEquals": false,
            "Next": "CheckCondition"
          }
        ]
      },
      "Send": {
        "Type": "Task",
        "Resource": module.send.lambda_function_arn,
        "End": true
      }
    }
  })
}

When creating the state machine with tflocal apply, I get the error:

aws_sfn_state_machine.ingest_sfn: Modifying... [id=arn:aws:states:ap-southeast-2:000000000000:stateMachine:test-state-machine]
╷
│ Error: updating Step Functions State Machine (arn:aws:states:ap-southeast-2:000000000000:stateMachine:test-state-machine): InvalidDefinition: None
│
│   with aws_sfn_state_machine.test_sfn,
│   on test.tf line 1, in resource "aws_sfn_state_machine" "test_sfn":
│    1: resource "aws_sfn_state_machine" "test_sfn" {

I am running an instance of Localstack using the following Docker run command

docker run -e PROVIDER_OVERRIDE_STEPFUNCTIONS=v2 -v //var/run/docker.sock:/var/run/docker.sock -p 4566:4566 -p 4571:4571 localstack/localstack

I am using the PROVIDER_OVERRIDE_STEPFUNCTIONS=v2 environment variable as another state machine is failing for other validation reasons without this override.

The error message gives no information as to what validation error has occurred with the definition.

InvalidDefinition: None

I have tried the following to find the validation error, if there is even any:

  • Pasting the definition into the AWS console
    • Passes validation, state machine created
  • Running a local Docker image of amazon/aws-stepfunctions-local and attempting to create a state machine with the same definition using the AWS CLI
    • Passes validation, state machine created
  • Hardcoded Localstack Lambda function ARNs
    • Passes validation, state machine created

Expected Behavior

State machine is created successfully.

How are you starting LocalStack?

With a docker run command

Steps To Reproduce

How are you starting localstack (e.g., bin/localstack command, arguments, or docker-compose.yml)

docker run -e PROVIDER_OVERRIDE_STEPFUNCTIONS=v2 -v //var/run/docker.sock:/var/run/docker.sock -p 4566:4566 -p 4571:4571 localstack/localstack

Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

tflocal init
tflocal apply

Environment

- OS: Windows 10 x64
- LocalStack: latest

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions