variable

package
v0.51.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 3, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package variable provides a way to parse and validate variables in a HCL file. Portions of this file are derived from the Waypoint project. Modifications have been made to meet the needs of the Phobos project. Source: https://github.com/hashicorp/waypoint/blob/7128fba03891df32b77e341d2380fe8f48a0b508/internal/config/variables/variables.go License: Mozilla Public License 2.0

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeVariablesWithContext added in v0.39.0

func DecodeVariablesWithContext(hclVariables map[string]hcl.Body, evalCtx *hcl.EvalContext) (map[string]*Variable, hcl.Diagnostics)

DecodeVariablesWithContext decodes variables from a HCL config and returns a map of variables and any diagnostics, with support for evaluating default values using the provided HCL evaluation context.

func GetCtyValuesForVariablesWithContext added in v0.39.0

func GetCtyValuesForVariablesWithContext(
	hclVariables map[string]hcl.Body,
	variableValues map[string]string,
	unknownVars bool,
	evalCtx *hcl.EvalContext,
) (map[string]cty.Value, error)

GetCtyValuesForVariablesWithContext returns a map of cty values for the given variable definitions and raw string values, with support for evaluating default values using the provided HCL evaluation context.

Types

type Variable

type Variable struct {
	Type    cty.Type
	Default *cty.Value
	Name    string
}

Variable represents a decoded variable from a HCL config.

func (*Variable) Value

func (v *Variable) Value(rawValue *string) (*cty.Value, error)

Value returns the cty value of the variable given the raw value. The default value is returned if the raw value is nil.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL