CloudFormation TaskDefinition with two different entry points based on condition

405 views Asked by At

I have to add taskdefintion entry based on condition. Below is the template i created.

Conditions
IsProdEnv:  !Equals [ !Ref envtype, "prod" ] 

TaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
        ContainerDefinitions:
            EntryPoint:
              - !If [IsProdEnv, !Split [",", ["python3", "hello.py"]], "./script.sh"]

I'm getting

Template error: every Fn::Split object requires two parameters, (1) a string delimiter and (2) a string to be split or a function that returns a string to be split.

1

There are 1 answers

1
Robert Kossendey On

You have two strings instead of one: "python3" and "hello.py". You need to have one string, e.g. "python3, hello.py". How this string looks, depends on your use-case.