Closed matt-FFFFFF closed 3 months ago
You can use EvaluateExpr
with cty.Value
instead of converting the given value to a Go primitive type as follows:
err := runner.EvaluateExpr(expr, func (val cty.Value), error {
// Test values
}, nil)
I did not know that - many thanks
Introduction
We have a scenario where we need to check if a resource attribute value is unknown.
The current
runner.EvaluateExpr
method needs a go type, which makes this difficult to ascertain as the conversion from cty to go types loses this information.Proposal
An additional method for the
tflint.Runner
interface that allows expression evaluation but returns acty.Value
.The caller can then make its own assertions on this value.
Alternatively
A way to return a fully populated
hcl.EvalContext
from the runner for use in(hcl.Expression) Value()
References