From 03ed7664545c7966809066ffe463d92601ccfcee Mon Sep 17 00:00:00 2001 From: James Bardin Date: Mon, 1 Nov 2021 14:30:25 -0400 Subject: [PATCH] nullable doc update --- website/docs/language/values/variables.html.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/website/docs/language/values/variables.html.md b/website/docs/language/values/variables.html.md index cd72c5abb..c540be2c7 100644 --- a/website/docs/language/values/variables.html.md +++ b/website/docs/language/values/variables.html.md @@ -310,6 +310,16 @@ random_pet.animal: Creation complete after 0s [id=jae-known-mongoose] -> This feature was introduced in Terraform v1.1.0. +The `nullable` argument in a variable block controls whether the module caller +may assign the value `null` to the variable: + +``` +variable "example" { + type = string + nullable = false +} +``` + The default value for `nullable` is `true`. When `nullable` is `true`, `null` is a valid value for the variable, and the module configuration must always account for the possibility of the variable value being `null`. Passing a @@ -320,6 +330,11 @@ Setting `nullable` to `false` ensures that the variable value will never be `default` value, then the default will be used when a `null` value is given as a module input argument. +`nullable` only controls where the direct value of the variable may be `null`. +For variables of collection or structural types, such as list or object types, +the caller may still use `null` in nested elements or attributes, as long as +the collection or structure itself is not null. + ## Using Input Variable Values