I want to be able to accept an optional Parameter
for the EntryPoint
of a AWS::ECS::TaskDefinition
-> ContainerDefinitions
[], in a YAML CloudFormation template. This is a little tricky, since ECS wants a comma-separated list for this, e.g. /bin/bash,-c,echo hello
, but in the CloudFormation template, it appears to be an array of string.
What is the best type to define for a EntryPoint
Parameter
in this case? The error I'm currently trying to avoid is:
Resource handler returned message: "Model validation failed (#/ContainerDefinitions/0/EntryPoint/0: expected type: String, found: JSONArray
I've defined the parameter currently as: CommaDelimitedList
:
EntryPoint:
Type: CommaDelimitedList
Description: "Task entrypoint (Optional - image default is script /start)"
... which is yielding a JSONArray
?, but I think I need an array of strings, which I'm not getting from:
ContainerDefinitions:
EntryPoint:
- !If
- EntryPointProvided
- !Ref EntryPoint
- !Ref 'AWS::NoValue'
What is the best type to use and the most direct processing to get to the type required in the template and by ECS? Or a current fix for the JSONArray would be fine. Thanks!
Spot on, perfect answer thanks Shane - clearly I missed that I was wrapping the dereference with that extra
-
. With this fix I am now able to pass arrays via comma-separated strings for bothEntryPoint
andCommand
via template parameters, which is awesome.