nullable variable docs
Add `nullable` to the variable documentation. Remove "module" from the "null means omission" part of the null type documentation.
This commit is contained in:
parent
079aabb70e
commit
6a1afd2dc3
|
@ -31,7 +31,7 @@ Strings, numbers, and bools are sometimes called _primitive types._ Lists/tuples
|
||||||
Finally, there is one special value that has _no_ type:
|
Finally, there is one special value that has _no_ type:
|
||||||
|
|
||||||
* `null`: a value that represents _absence_ or _omission._ If you set an
|
* `null`: a value that represents _absence_ or _omission._ If you set an
|
||||||
argument of a resource or module to `null`, Terraform behaves as though you
|
argument of a resource to `null`, Terraform behaves as though you
|
||||||
had completely omitted it — it will use the argument's default value if it has
|
had completely omitted it — it will use the argument's default value if it has
|
||||||
one, or raise an error if the argument is mandatory. `null` is most useful in
|
one, or raise an error if the argument is mandatory. `null` is most useful in
|
||||||
conditional expressions, so you can dynamically omit an argument if a
|
conditional expressions, so you can dynamically omit an argument if a
|
||||||
|
|
|
@ -84,6 +84,7 @@ Terraform CLI defines the following optional arguments for variable declarations
|
||||||
- [`description`][inpage-description] - This specifies the input variable's documentation.
|
- [`description`][inpage-description] - This specifies the input variable's documentation.
|
||||||
- [`validation`][inpage-validation] - A block to define validation rules, usually in addition to type constraints.
|
- [`validation`][inpage-validation] - A block to define validation rules, usually in addition to type constraints.
|
||||||
- [`sensitive`][inpage-sensitive] - Limits Terraform UI output when the variable is used in configuration.
|
- [`sensitive`][inpage-sensitive] - Limits Terraform UI output when the variable is used in configuration.
|
||||||
|
- [`nullable`][inpage-nullable] - Specify if the variable can be `null` within the module.
|
||||||
|
|
||||||
### Default values
|
### Default values
|
||||||
|
|
||||||
|
@ -303,6 +304,23 @@ random_pet.animal: Creating...
|
||||||
random_pet.animal: Creation complete after 0s [id=jae-known-mongoose]
|
random_pet.animal: Creation complete after 0s [id=jae-known-mongoose]
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Disallowing null Module Input Values
|
||||||
|
|
||||||
|
[inpage-nullable]: #disallowing-null-input-values
|
||||||
|
|
||||||
|
-> This feature was introduced in Terraform v1.1.0.
|
||||||
|
|
||||||
|
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
|
||||||
|
`null` value as a module input argument will override any `default` value.
|
||||||
|
|
||||||
|
Setting `nullable` to `false` ensures that the variable value will never be
|
||||||
|
`null` within the module. If `nullable` is `false` and the variable has a
|
||||||
|
`default` value, then the default will be used when a `null` value is given as
|
||||||
|
a module input argument.
|
||||||
|
|
||||||
|
|
||||||
## Using Input Variable Values
|
## Using Input Variable Values
|
||||||
|
|
||||||
Within the module that declared a variable, its value can be accessed from
|
Within the module that declared a variable, its value can be accessed from
|
||||||
|
|
Loading…
Reference in New Issue