terraform/lang
Martin Atkins cec4578005 lang/funcs: Experimental "defaults" function
This is a new part of the existing module_variable_optional_attrs
experiment, because it's intended to complement the ability to declare
an input variable whose type constraint is an object type with optional
attributes. Module authors can use this to replace null values (that were
either explicitly set or implied by attribute omission) with other
non-null values of the same type.

This function is a bit more type-fussy than our functions typically are
because it's intended for use primarily with input variables that have
fully-specified type constraints, and thus it uses that type information
to help inform how the defaults data structure should be interpreted.

Other uses of this function will probably be harder today because it takes
a lot of extra annotation to build a value of a specific type if it isn't
passing through a variable type constraint. Perhaps later language
features for more general type conversion will make this more applicable,
but for now the more general form of this problem is better solved other
ways.
2020-11-13 17:27:20 -08:00
..
blocktoattr add benchmark used for DecoderSpec 2020-10-14 09:19:26 -04:00
funcs lang/funcs: Experimental "defaults" function 2020-11-13 17:27:20 -08:00
testdata/functions-test lang/funcs: Update fileset() function to include path as separate first argument, automatically trim the path argument from results, and ensure results are always canonical with forward slash path separators 2019-08-30 20:19:44 -04:00
data.go remove GetModuleInstanceOutput 2020-04-14 14:49:10 -04:00
data_test.go eval Data needs to operate on whole modules 2020-04-12 10:50:31 -04:00
doc.go lang: new package for the runtime parts of the config language 2018-10-16 18:44:26 -07:00
eval.go allow path and terraform in self-block eval 2020-11-02 14:00:58 -05:00
eval_test.go allow path and terraform in self-block eval 2020-11-02 14:00:58 -05:00
functions.go lang/funcs: Experimental "defaults" function 2020-11-13 17:27:20 -08:00
functions_test.go lang/funcs: Experimental "defaults" function 2020-11-13 17:27:20 -08:00
references.go vendor: switch to HCL 2.0 in the HCL repository 2019-10-02 15:10:21 -07:00
scope.go lang: allow functions to be subject to experiments 2020-11-13 17:25:16 -08:00