terraform console: enable use of impure functions#25442
Conversation
Codecov Report
|
apparentlymart
left a comment
There was a problem hiding this comment.
This looks good to me!
The sort of testing I might suggest here is testing of the sort we have in the context_*_test.go files... perhaps we could add a new context_eval_test.go file and have it mimic how terraform console calls ctx.Eval, and then get an evaluation scope out of it the same way as terraform console does and run a table of "this expression in, that result out" tests against it so we can verify that it's able to access the sorts of things we expect console to be able to access: these functions, local values defined in the configuration test fixture, and maybe some other bits and bobs if they are easy to write without blowing up the scope of what you were trying to solve here.
bc2e0d6 to
e6d47ff
Compare
|
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further. |
Allow impure funcs in
walkEval, which is used byterraform console.I wrote a bit of a unit test for this, but it was so very simplistic that it did not seem worth doing (the test seemed more likely to give a false sense of coverage). I will happily do it anyway, or take other suggestions!
I am also considering what additional documentation might be useful here, if any. I started writing a note about impure functions in the
consoledocumentation to warn users about impure functions, but it felt pretty awkward. I'm inclined to skip it for now unless we start getting questions, but I can go back to that if y'all think it's something we should add now.