serverless-operations / serverless-step-functions

AWS Step Functions plugin for Serverless Framework ⚡️
Other
1.03k stars 203 forks source link

Generate policy statements for "Call third-party API" states #599

Open yuyokk opened 10 months ago

yuyokk commented 10 months ago

This is a Feature Request

Description

AWS announced ability to call external endpoints at AWS re:invent.

If I define following state:

Call api:
  Type: Task
  Resource: arn:aws:states:::http:invoke
  Parameters:
    ApiEndpoint.$: '$.apiUrl'
    Method.$: '$.method'
    Authentication:
      ConnectionArn.$: '$.connectionArn'

During deploy I see the following warning

Cannot generate IAM policy statement for Task state { Type: 'Task',
  Resource: 'arn:aws:states:::http:invoke',
  Parameters:
   { 'ApiEndpoint.$': '$.apiUrl',
     'Method.$': '$.method',
     Authentication: { 'ConnectionArn.$': '$.connectionArn' } },
  Next: 'Success' }
✓ State machine "TestStepFunction" definition is valid

And during run my Step Function fails with

AWS Step Functions is not authorized to perform states:InvokeHTTPEndpoint on API Endpoint https://example.com. Ensure that the StateMachine role contains the states:InvokeHTTPEndpoint permission for the given API Endpoint

Additional Data