-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add standard for nullable/empty input variables
- Loading branch information
Showing
2 changed files
with
26 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
# Input Variables | ||
|
||
If an input variable needs to be defined as null or emtpy: | ||
|
||
- prefer using a `nullable` variable with a default value of `null` | ||
- if a `nullable` variable is not possible, use a `string` variable with a default value of `""` and add an explanation why. | ||
|
||
Examples: | ||
|
||
```hcl | ||
variable "foo" { | ||
type = string | ||
description = "This variable is a string that can be null" | ||
default = null | ||
} | ||
variable "bar" { | ||
type = string | ||
description = "This variable is a string that can be empty, but not null" | ||
nullable = false | ||
# Add an explanation why this variable is not nullable | ||
default = "" | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters