gruntwork-io / boilerplate

A tool for generating files and folders ("boilerplate") from a set of templates
https://www.gruntwork.io
183 stars 16 forks source link

Error message for valid, but incomplete YAML is confusing: #29

Open josh-padnick opened 7 years ago

josh-padnick commented 7 years ago

Given this boilerplate.yml:

# Note that this YML is missing a "variables" declaration at the top!
- name: IncludeAutoScalingExample
  description: Should we include an example of how to auto scaling the service based on CPU usage (true or false)?
  type: bool

- name: UseGruntKms
  description: Should we use gruntkms (true or false)?
  type: bool

When I run this command:

boilerplate --template-folder stacks/clients/bolste/patterns/us-west-2/ \
            --non-interactive \
            --output-folder /repos/gruntwork-clients/bolste/

I get this output:

...
[boilerplate] 2017/01/18 21:27:37 Processing dependency ecs-service-golang-sample, with template folder patterns/infrastructure-modules/services/ecs-service-with-alb and output folder /repos/gruntwork-clients/bolste/infrastructure-modules/ecs-service-golang-sample
[boilerplate] 2017/01/18 21:27:37 Loading boilerplate config from patterns/infrastructure-modules/services/ecs-service-with-alb/boilerplate.yml
yaml: unmarshal errors:
  line 6: cannot unmarshal !!seq into map[string]interface {}

While the YAML is valid YAML, it's missing a variables declaration at the top. The action item here is to output a more helpful error message.