question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for Fn::GetAtt in the Step Function Resource Attributes

See original GitHub issue

Currently, step functions can be written using the new functionality in AWS toolkit, which is quite helpful. One thing I do, is handle all deployment using serverless. For that, I parameterize my resources using the Fn::GetAtt instead of hardcoding the name of the lambda function in the JSON definition.

For example, the following state will be okay with serverless framework, but the rendering does not accept it:

"Downloader":{
      "Type": "Task",
      "Resource": {"Fn::GetAtt": ["download-handler", "Arn"]},
      "Catch": [
        {
          "ErrorEquals": [
            "Runtime.ExitError"
          ],
          "Next": "RedefineParameters"
        },
        {
          "ErrorEquals": [
            "Task.Failed"
          ],
          "Next": "HandleFailure"
        }
      ],
      "Retry": [ {
              "ErrorEquals": ["Lambda.ServiceException", "Lambda.AWSLambdaException", "Lambda.SdkClientException", "Lambda.TooManyRequestsException"],
              "IntervalSeconds": 5,
              "MaxAttempts": 10,
              "BackoffRate": 2
            } ],
      "ResultPath": "$.results",
      "Next": "IsCommpleted"
    }

Describe the solution you’d like I would like this to not be flagged as a faulty JSON definition and the rendering to work

Describe alternatives you’ve considered I have been manually removing all my parameterized resource names with empty "". But this can be tedious and error prone as your state machine grows in size

Additional context Serverless will accept the JSON as write above, which is great. But the rendering of the state machine is not working which causes problems with dev speed

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:10 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ffxsamcommented, Dec 15, 2020

Just wanted to throw my hat into the ring here, in support of this change/fix. I understand "Resource": {"Fn::GetAtt": ["download-handler", "Arn"]} is not valid as far as a raw state definition. But if the purpose is to help us visualize the step function before deploying it, and many people are using SAM or Serverless Framework, it would make sense to allow Resource to be an object.

It’s a bit tedious to go through and temporarily replace the resources with strings.

0reactions
ffxsamcommented, Jul 1, 2021

@bryceitoc9 I noticed this was closed with no details given. Is this a wontfix? What’s the status of this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fn::GetAtt - AWS CloudFormation
Return the value of an attribute from the resource in the AWS CloudFormation template by using the Fn::GetAtt intrinsic function.
Read more >
How can I nest a serverless Step Function / State Machine ...
I have written a service using AWS Step Functions. ... How can I access ElasticBeanstalk environment properties from within Step Functions?
Read more >
EventBridge Rules to Invoke Lambda and StepFunction
I created a test Lambda function and a test StepFunction state machine ... rule to invoke another service resource (i.e. StepFunction state ...
Read more >
Public/Intrinisic Functions/Add-FnGetAtt.ps1 0.0.6
The Fn::GetAtt intrinsic function returns the value of an attribute from a resource in the template. ... The logical name of the resource...
Read more >
ICYMI: five updates you've missed about Serverless Step ...
Here are the most impactful changes, in case you missed it! Support for intrinsic function. One of the main pain points of using...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found