mercari / hcledit

Go package to edit HCL configuration
MIT License
44 stars 13 forks source link

[hcledit] add a way to get EvalContext from HCLEditor #99

Closed ryan-ph closed 4 months ago

ryan-ph commented 4 months ago

WHAT

Adds a way to pull information from an HCLEditor into EvalContext so that we can evaluate values in multiple files.

This PR does not update the CLI to be able to take multiple HCL files to read interpolated values.

WHY

Currently HCLEditor.Read() cannot parse any interpolated values. This is somewhat necessary when using this module outside of the CLI where we do have access to multiple different HCLEditor instances that may contain concrete values that can be used during evaluation.

As a simple implementation, expose some APIs that users can use to parse and update EvalContext in top-to-bottom order starting with variables, then locals.