opentofu/lang/funcs
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
..
testdata lang/funcs: templatefile function 2018-12-21 08:06:14 -08:00
cidr_test.go add test cases and remove no-longer-needed validation 2020-07-08 13:53:54 -04:00
cidr.go add test cases and remove no-longer-needed validation 2020-07-08 13:53:54 -04:00
collection_test.go lang/funcs: Remove the deprecated "list" and "map" functions 2020-11-04 17:05:59 -08:00
collection.go lang/funcs: Remove the deprecated "list" and "map" functions 2020-11-04 17:05:59 -08:00
conversion_test.go lang/funcs: Type conversion functions 2019-01-17 10:01:47 -08:00
conversion.go lang/funcs: Type conversion functions 2019-01-17 10:01:47 -08:00
crypto_test.go lang/funcs: Add support for OpenSSH RSA key format 2020-06-03 10:50:38 -04:00
crypto.go lang/funcs: Add support for OpenSSH RSA key format 2020-06-03 10:50:38 -04:00
datetime_test.go cleanup comments for nicer godocs 2018-10-16 18:49:20 -07:00
datetime.go cleanup comments for nicer godocs 2018-10-16 18:49:20 -07:00
defaults_test.go lang/funcs: Experimental "defaults" function 2020-11-13 17:27:20 -08:00
defaults.go lang/funcs: Experimental "defaults" function 2020-11-13 17:27:20 -08:00
encoding_test.go lang/funcs: Rename the base64 character encoding functions 2020-10-21 10:56:56 -07:00
encoding.go lang/funcs: Rename the base64 character encoding functions 2020-10-21 10:56:56 -07:00
filesystem_test.go lang/funcs: Filesystem functions hint about dynamically-generated files 2020-06-24 09:02:38 -07:00
filesystem.go lang/funcs: Filesystem functions hint about dynamically-generated files 2020-06-24 09:02:38 -07:00
number_test.go remove old funcs code 2020-03-03 15:23:58 -05:00
number.go remove old funcs code 2020-03-03 15:23:58 -05:00
string_test.go remove old funcs code 2020-03-03 15:23:58 -05:00
string.go remove old funcs code 2020-03-03 15:23:58 -05:00