Skip to content

Bug: References always converted into strings for Step Functions definition substitutions - Can't use a CF parameter for TimeoutSeconds attribute (Integer) #1616

@alexcasalboni

Description

@alexcasalboni

Description: when I create a AWS::Serverless::StateMachine resource, I'd like to parametrize the value of my state's TimeoutSeconds attribute using a CloudFormation parameter.

I've defined the parameter as follows:

Parameters: 
  myParameter:
    Type: Number
    Default: 300

and I'm referencing it in my task definition as follows:

myTask:
  Type: Task
  Resource: !GetAtt myfunction.Arn
  End: true
  TimeoutSeconds: !Ref myParameter

Steps to reproduce the issue:

  1. Define a CloudFormation parameter
  2. Define a Step Functions state
  3. Try to reference the parameter in the TimeoutSeconds attribute

Observed result:

The deployment fails with this error message:

Invalid State Machine Definition: 'SCHEMA_VALIDATION_FAILED: Expected value of type Integer

Expected result:

I'd expect the deploy to succeed since the parameter type and value are valid.

My understanding is that CloudFormation treats every parameter as a string under the hood, even if you define it as Type: Number. But then how do I get to use this parameter as an Integer, as SAM is expecting? Is this a SAM issue or a Step Functions issue?

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/intrinsicsRef, If, Sub, GetAtt, ...area/step-functionstage/pm-reviewWaiting for review by our Product Manager, please don't work on this yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions