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

Fix rendering issue when variable value contains templates syntax #92

Closed yorinasub17 closed 2 years ago

yorinasub17 commented 2 years ago

Description

Fix https://github.com/gruntwork-io/boilerplate/issues/89

The old implementation of recursively rendering the variables breaks a valid use case where you want to render a config file that relies on Go template syntax (e.g., Github Actions), as boilerplate will always try to render the nested template that we don't want rendered. This old implementation existed because we wanted to support nested variable lookups in the variable values.

To address this, I updated the variable rendering logic to use an approach similar to what we do in terragrunt with locals:

This new approach should handle both use cases where we have multiple, nested variable references and the case where we want to output Go template syntax in a boilerplate variable value.

TODOs

Please ensure all of these TODOs are completed before asking for a review.

yorinasub17 commented 2 years ago

Thanks for review! Merging this in now.