Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: Minimal working implementation of provider-contributed functions
This establishes all of the wiring necessary for a provider's declared functions to appear in the hcl.EvalContext when we evaluate expressions inside a module that depends on a provider that contributes functions. Although this includes the minimum required machinery to make it work, it is still lacking in a few different ways: - It spins up an entirely new instance of the contributing provider for each individual function call, which is likely to be pretty slow and memory intensive for real plugins that run as child processes. We'll need to find some way to reuse these for multiple calls and then clean them up when we're finished. - It doesn't make any attempts to guarantee that the provider-contributed functions correctly honor the contracts such as behaving as pure functions. Properly checking this is important because if a function doesn't uphold Terraform's expectations then it will cause confusing errors reported downstream, incorrectly blaming other components for the inconsistency. With that said then, there's still plenty more work to do here before this could be shipped but at least it demonstrates that provider-contributed functions are viable and demonstrates one design for how they might appear in the Terraform language.
- Loading branch information