martinohmann / hcl-rs

HCL parsing and encoding libraries for rust with serde support
Apache License 2.0
121 stars 14 forks source link

feat(eval): add `Evaluate::evaluate_in_place` #292

Closed martinohmann closed 11 months ago

martinohmann commented 11 months ago

Closes #184.

Key difference to the existing Evaluate::evaluate method:

This allows for partial expression evaluation, e.g. to support use cases where a HCL document contains variable references to other parts within the same document that themselves contain expressions that are not evaluated yet.

In this case one would:

  1. Partially evaluate the document via evaluate_in_place.
  2. Update the Context with newly discovered variables.
  3. Repeat 1. and 2. until there are no more errors left.