'Yaml validation error on TaskDefinition preventing cloudformation from reaching completion
I'm trying to create a cloudformation for a Task Definition but I keep running into validation errors on the command portion of the Task Definition. I've tried a few approaches and can't seem to get it right.
I've been following the documentation here.
Below are 2 of my main attempts and their respective errors:
Command: !Sub
- "--config config.yaml --env ${environment}"
- { environment: !FindInMap [EnvironmentVariables, !Ref Environment, Environment] }
Environment] }
Error:
#/ContainerDefinitions/0/Command: expected type: JSONArray, found: String)
Command: !Sub
- [--config, config.yaml, --env, ${environment}]
- { environment: !FindInMap [EnvironmentVariables, !Ref Environment, Environment] }
Template format error: YAML not well-formed.
Solution 1:[1]
There seems to be some issue with how !Sub interacts with a Yaml list but I'm not exactly sure what causes this to be the case.
However the below piece of Yaml managed to solve my problem.
Command:
- --config
- config.yaml
- --env
- !FindInMap [EnvironmentVariables, !Ref Environment, Environment]
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Damian Jacobs |
