serverless-application-model icon indicating copy to clipboard operation
serverless-application-model copied to clipboard

EcsRunTaskPolicy should take ECS ARN, not task definition (family:revision)

Open smatsumt opened this issue 5 years ago • 1 comments

Description:

"EcsRunTaskPolicy" policy template in policy_templates.json takes one argument, TaskDefinition. It is assumed to be (family:revision), e.g. "EcsTaskName:1"

But Ref for AWS::ECS::TaskDefinition returns Task's ARN. So, following code would not work.

Resources:
  SomeFunction:
    Type: AWS::Serverless::Function
    Properties:
      Policies:
        - EcsRunTaskPolicy
           TaskDefinition: !Ref SomeECSTaskDefinition

  SomeECSTaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:

If TaskDefinition argument takes ARN format, the above code would work. We can refer ECS task definition in the CloudFormation template.

I think TaskDefinition should takes ARN format. How about it?

smatsumt avatar Oct 12 '20 12:10 smatsumt

I am struggling with the same issue. Are there other options currently than hard-coding the TaskDefinition into the template by hand?

vesahyp avatar Aug 20 '21 09:08 vesahyp