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
158 stars 12 forks source link

Introduce a new helper function 'include' #55

Closed yorinasub17 closed 4 years ago

yorinasub17 commented 4 years ago

This introduces include, a new helper function inspired by the same function in helm, which can be used as an alternative to snippet. The function works almost exactly like snippet, except instead of copying the contents verbatim, it can be used to pass the contents through the templating engine prior to including. This promotes reusability by having a common set of template text where we use boilerplate.

The primary use case is to refactor the provider code in the CIS compliance reference architecture so that we can reference variables like AwsRegion into a common snippet that is injected.

yorinasub17 commented 4 years ago

Between the unit test and the active integration test in https://github.com/gruntwork-io/usage-patterns/pull/354, I am reasonably confident in the functionality of this helper.

Since we need this in the cis ref arch, I am going to go ahead and merge + release this now.

Feedback and review is still welcome: happy to address any comments in a subsequent PR.