MCPcopy
hub / github.com/opentofu/opentofu / decodeStaticVersion

Method decodeStaticVersion

internal/configs/module_call.go:258–284  ·  view source on GitHub ↗
(ctx context.Context, eval *StaticEvaluator)

Source from the content-addressed store, hash-verified

256}
257
258func (mc *ModuleCall) decodeStaticVersion(ctx context.Context, eval *StaticEvaluator) hcl.Diagnostics {
259 var diags hcl.Diagnostics
260
261 if mc.VersionAttr == nil {
262 return diags
263 }
264
265 val, valDiags := eval.Evaluate(ctx, mc.VersionAttr.Expr, StaticIdentifier{
266 Module: eval.call.addr,
267 Subject: fmt.Sprintf("module.%s.version", mc.Name),
268 DeclRange: mc.VersionAttr.Range,
269 })
270 diags = diags.Extend(valDiags)
271 if diags.HasErrors() {
272 return diags
273 }
274
275 // If the version evaluates to null, treat it as if no version was specified
276 if val.IsNull() {
277 mc.VersionAttr = nil
278 return diags
279 }
280
281 var verDiags hcl.Diagnostics
282 mc.Version, verDiags = decodeVersionConstraintValue(mc.VersionAttr, val)
283 return diags.Extend(verDiags)
284}
285
286func (mc *ModuleCall) decodeStaticVariables(ctx context.Context, eval *StaticEvaluator) {
287 attr, _ := mc.Config.JustAttributes()

Callers 1

decodeStaticFieldsMethod · 0.95

Calls 3

HasErrorsMethod · 0.95
EvaluateMethod · 0.65

Tested by

no test coverage detected