gruntwork-io / boilerplate

A tool for generating files and folders ("boilerplate") from a set of templates
https://www.gruntwork.io
Mozilla Public License 2.0
157 stars 12 forks source link

`missing-key-action` Ignored #172

Open yhakbar opened 3 months ago

yhakbar commented 3 months ago

Describe the bug The behavior of empty variables changes depending on whether a --var is passed into the invocation of boilerplate or not.

If the boilerplate.yml has a variable with a default value of "" and no --var is passed in to determine the value, an empty string is stamped out into the output folder.

If a --var is populated with an empty string, --var EmptyVariable='' it will stamp out <no value>.

If a --var is populated with an empty string inside an empty string, --var EmptyVariable='""' it will stamp out an empty string.

Using the missing-key-action zero does not change this behavior.

To Reproduce Take a look at the branch bug/missing-key-action-ignored.

In this branch, the following command was run:

boilerplate \
--template-url examples/for-learning-and-testing/empty-variable \
--output-folder test-fixtures/examples-expected-output/empty-variable \
--var EmptyVariable=''  \
--non-interactive \
--missing-key-action zero

Expected behavior In this example, a user likely expects for an empty string to be stamped out into the target output folder.

Nice to have