(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext)
| 1519 | } |
| 1520 | |
| 1521 | func (s *TransformExprSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { |
| 1522 | wrappedVal, diags := s.Wrapped.decode(content, blockLabels, ctx) |
| 1523 | if diags.HasErrors() { |
| 1524 | // We won't try to run our function in this case, because it'll probably |
| 1525 | // generate confusing additional errors that will distract from the |
| 1526 | // root cause. |
| 1527 | return cty.UnknownVal(s.impliedType().WithoutOptionalAttributesDeep()), diags |
| 1528 | } |
| 1529 | |
| 1530 | chiCtx := s.TransformCtx.NewChild() |
| 1531 | chiCtx.Variables = map[string]cty.Value{ |
| 1532 | s.VarName: wrappedVal, |
| 1533 | } |
| 1534 | resultVal, resultDiags := s.Expr.Value(chiCtx) |
| 1535 | diags = append(diags, resultDiags...) |
| 1536 | return resultVal, diags |
| 1537 | } |
| 1538 | |
| 1539 | func (s *TransformExprSpec) impliedType() cty.Type { |
| 1540 | wrappedTy := s.Wrapped.impliedType() |
nothing calls this directly
no test coverage detected