variable

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: MPL-2.0 Imports: 8 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 DecodeVariables

func DecodeVariables(hclVariables map[string]hcl.Body) (map[string]*Variable, hcl.Diagnostics)

DecodeVariables decodes variables from a HCL config and returns a map of variables and any diagnostics.

func GetCtyValuesForVariables

func GetCtyValuesForVariables(
	hclVariables map[string]hcl.Body,
	variableValues map[string]string,
	unknownVars bool,
) (map[string]cty.Value, error)

GetCtyValuesForVariables returns a map of cty values for the given variable definitions and raw string values.

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