MCPcopy Index your code
hub / github.com/coder/coder / VariableDefaults

Method VariableDefaults

provisioner/terraform/tfparse/tfparse.go:297–313  ·  view source on GitHub ↗

VariableDefaults returns the default values for all variables in the module.

(ctx context.Context)

Source from the content-addressed store, hash-verified

295
296// VariableDefaults returns the default values for all variables in the module.
297func (p *Parser) VariableDefaults(ctx context.Context) (map[string]string, error) {
298 // iterate through vars to get the default values for all
299 // required variables.
300 m := make(map[string]string)
301 for _, v := range p.module.Variables {
302 if v == nil {
303 continue
304 }
305 sv, err := interfaceToString(v.Default)
306 if err != nil {
307 return nil, xerrors.Errorf("can't convert variable default value to string: %v", err)
308 }
309 m[v.Name] = strings.Trim(sv, `"`)
310 }
311 p.logger.Debug(ctx, "found default values for variables", slog.F("defaults", m))
312 return m, nil
313}
314
315// CoderParameterDefaults returns the default values of all coder_parameter data sources
316// in the parsed module.

Callers 1

WorkspaceTagDefaultsMethod · 0.95

Calls 2

interfaceToStringFunction · 0.85
ErrorfMethod · 0.45

Tested by

no test coverage detected