inputvars

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: AGPL-3.0 Imports: 32 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(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)

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

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(mode var_config.VariableParsingMode) (*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).

Jump to

Keyboard shortcuts

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