kubeform.dev/terraform-backend-sdk@v0.0.0-20220310143633-45f07fe731c5/configs/variable_type_hint.go (about) 1 package configs 2 3 // VariableTypeHint is an enumeration used for the Variable.TypeHint field, 4 // which is an incompletely-specified type for the variable which is used 5 // as a hint for whether a value provided in an ambiguous context (on the 6 // command line or in an environment variable) should be taken literally as a 7 // string or parsed as an HCL expression to produce a data structure. 8 // 9 // The type hint is applied to runtime values as well, but since it does not 10 // accurately describe a precise type it is not fully-sufficient to infer 11 // the dynamic type of a value passed through a variable. 12 // 13 // These hints use inaccurate terminology for historical reasons. Full details 14 // are in the documentation for each constant in this enumeration, but in 15 // summary: 16 // 17 // TypeHintString requires a primitive type 18 // TypeHintList requires a type that could be converted to a tuple 19 // TypeHintMap requires a type that could be converted to an object 20 type VariableTypeHint rune 21 22 //go:generate go run golang.org/x/tools/cmd/stringer -type VariableTypeHint 23 24 // TypeHintNone indicates the absence of a type hint. Values specified in 25 // ambiguous contexts will be treated as literal strings, as if TypeHintString 26 // were selected, but no runtime value checks will be applied. This is reasonable 27 // type hint for a module that is never intended to be used at the top-level 28 // of a configuration, since descendent modules never receive values from 29 // ambiguous contexts. 30 const TypeHintNone VariableTypeHint = 0 31 32 // TypeHintString spec indicates that a value provided in an ambiguous context 33 // should be treated as a literal string, and additionally requires that the 34 // runtime value for the variable is of a primitive type (string, number, bool). 35 const TypeHintString VariableTypeHint = 'S' 36 37 // TypeHintList indicates that a value provided in an ambiguous context should 38 // be treated as an HCL expression, and additionally requires that the 39 // runtime value for the variable is of an tuple, list, or set type. 40 const TypeHintList VariableTypeHint = 'L' 41 42 // TypeHintMap indicates that a value provided in an ambiguous context should 43 // be treated as an HCL expression, and additionally requires that the 44 // runtime value for the variable is of an object or map type. 45 const TypeHintMap VariableTypeHint = 'M'