makeStubFunction returns a function.Function with the required return type and parameters that will always return an unknown type and an error.
(name string, returnType cty.Type, params ...function.Parameter)
| 152 | // makeStubFunction returns a function.Function with the required return type and parameters |
| 153 | // that will always return an unknown type and an error. |
| 154 | func makeStubFunction(name string, returnType cty.Type, params ...function.Parameter) function.Function { |
| 155 | var spec function.Spec |
| 156 | spec.Params = params |
| 157 | spec.Type = function.StaticReturnType(returnType) |
| 158 | spec.Impl = func(_ []cty.Value, _ cty.Type) (cty.Value, error) { |
| 159 | return cty.UnknownVal(returnType), xerrors.Errorf("function %q may not be used here", name) |
| 160 | } |
| 161 | return function.New(&spec) |
| 162 | } |