inputvars

package
v1.6.6 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: AGPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

View Source
const ValueFromModFile terraform.ValueSourceType = 'M'

Variables

This section is empty.

Functions

func CheckInputVariables

func CheckInputVariables(defs map[string]*modconfig.Variable, values terraform.InputValues) tfdiags.Diagnostics

CheckInputVariables ensures that variable values supplied at the UI conform to their corresponding declarations in configuration.

The set of values is considered valid only if the returned diagnostics does not contain errors. A valid set of values may still produce warnings, which should be returned to the user.

func CollectVariableValues

func CollectVariableValues(workspacePath string, variableFileArgs []string, variablesArgs []string, workspaceModName string) (map[string]UnparsedVariableValue, error)

CollectVariableValues inspects the various places that configuration input variable values can come from and constructs a map ready to be passed to the backend as part of a Operation.

This method returns diagnostics relating to the collection of the values, but the values themselves may produce additional diagnostics when finally parsed.

func CollectVariableValuesFromModRequire

func CollectVariableValuesFromModRequire(m *modconfig.Mod, lock *versionmap.WorkspaceLock) (terraform.InputValues, error)

func ParseVariableValues

func ParseVariableValues(evalContext *hcl.EvalContext, inputValueUnparsed map[string]UnparsedVariableValue, requireArgs terraform.InputValues, variablesMap *modconfig.ModVariableMap, validate bool) (terraform.InputValues, tfdiags.Diagnostics)

ParseVariableValues processes a map of unparsed variable values by correlating each one with the given variable declarations which should be from a configuration.

It also takes into account parsed values which are declares in the mod require block

The map of unparsed variable values should include variables from all possible configuration declarations sources such that it is as complete as it can possibly be for the current operation. If any declared variables are not included in the map, ParseVariableValues will either substitute a configured default value or produce an error.

func SetVariableValues

func SetVariableValues(vv terraform.InputValues, m *modconfig.ModVariableMap) error

SetVariableValues determines whether the given variable is a public variable and if so sets its value

func SourceTypeString

func SourceTypeString(v *terraform.InputValue) string

Types

type UIInput

type UIInput struct {
	// Colorize will color the output.
	Colorize *colorstring.Colorize

	// Reader and Writer for IO. If these aren't set, they will default to
	// Stdin and Stdout respectively.
	Reader io.Reader
	Writer io.Writer
	// contains filtered or unexported fields
}

UIInput is an implementation of terraform.UIInput that asks the CLI for input stdin.

func (*UIInput) Input

func (i *UIInput) Input(ctx context.Context, opts *terraform.InputOpts) (string, error)

type UnparsedInteractiveVariableValue

type UnparsedInteractiveVariableValue struct {
	Name, RawValue string
}

func (UnparsedInteractiveVariableValue) ParseVariableValue

func (v UnparsedInteractiveVariableValue) ParseVariableValue(evalCtx *hcl.EvalContext, mode modconfig.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics)

func (UnparsedInteractiveVariableValue) ParseVariableValueToType added in v1.6.4

func (v UnparsedInteractiveVariableValue) ParseVariableValueToType(evalCtx *hcl.EvalContext, mode modconfig.VariableParsingMode, targetType cty.Type) (*terraform.InputValue, tfdiags.Diagnostics)

type UnparsedVariableValue

type UnparsedVariableValue interface {
	// ParseVariableValue information in the provided variable configuration
	// to parse (if necessary) and return the variable value encapsulated in
	// the receiver.
	//
	// If error diagnostics are returned, the resulting value may be invalid
	// or incomplete.
	ParseVariableValue(evalCtx *hcl.EvalContext, mode modconfig.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics)
	ParseVariableValueToType(evalCtx *hcl.EvalContext, mode modconfig.VariableParsingMode, targetType cty.Type) (*terraform.InputValue, tfdiags.Diagnostics)
}

UnparsedVariableValue represents a variable value provided by the caller whose parsing must be deferred until configuration is available.

This exists to allow processing of variable-setting arguments (e.g. in the command package) to be separated from parsing (in the backend package).

type UnparsedVariableValueString added in v1.6.1

type UnparsedVariableValueString struct {
	// contains filtered or unexported fields
}

UnparsedVariableValueString is a UnparsedVariableValue implementation that parses its value from a string. This can be used to deal with values given directly on the command line and via environment variables.

func (UnparsedVariableValueString) ParseVariableValue added in v1.6.1

func (v UnparsedVariableValueString) ParseVariableValue(evalCtx *hcl.EvalContext, mode modconfig.VariableParsingMode) (*terraform.InputValue, tfdiags.Diagnostics)

func (UnparsedVariableValueString) ParseVariableValueToType added in v1.6.4

func (v UnparsedVariableValueString) ParseVariableValueToType(evalCtx *hcl.EvalContext, mode modconfig.VariableParsingMode, targetType cty.Type) (*terraform.InputValue, tfdiags.Diagnostics)

func (UnparsedVariableValueString) Raw added in v1.6.1

Jump to

Keyboard shortcuts

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