(ctx context.Context, body hcl.Body, spec hcldec.Spec, ident StaticIdentifier)
| 127 | } |
| 128 | |
| 129 | func (s StaticEvaluator) DecodeBlock(ctx context.Context, body hcl.Body, spec hcldec.Spec, ident StaticIdentifier) (cty.Value, hcl.Diagnostics) { |
| 130 | var diags hcl.Diagnostics |
| 131 | |
| 132 | refs, refsDiags := lang.References(addrs.ParseRef, hcldec.Variables(body, spec)) |
| 133 | diags = append(diags, refsDiags.ToHCL()...) |
| 134 | if diags.HasErrors() { |
| 135 | return cty.DynamicVal, diags |
| 136 | } |
| 137 | |
| 138 | hclCtx, ctxDiags := s.scope(ident).EvalContext(ctx, refs) |
| 139 | diags = append(diags, ctxDiags.ToHCL()...) |
| 140 | if diags.HasErrors() { |
| 141 | return cty.DynamicVal, diags |
| 142 | } |
| 143 | |
| 144 | val, valDiags := hcldec.Decode(body, spec, hclCtx) |
| 145 | diags = append(diags, valDiags...) |
| 146 | return val, diags |
| 147 | } |
| 148 | |
| 149 | func (s StaticEvaluator) EvalContext(ctx context.Context, ident StaticIdentifier, refs []*addrs.Reference) (*hcl.EvalContext, hcl.Diagnostics) { |
| 150 | return s.EvalContextWithParent(ctx, nil, ident, refs) |
no test coverage detected