github.com/hugorut/terraform@v1.1.3/src/terraform/testdata/apply-nullable-variables/mod/main.tf (about) 1 // optional, and this can take null as an input 2 variable "nullable_null_default" { 3 // This is implied now as the default, and probably should be implied even 4 // when nullable=false is the default, so we're leaving this unset for the test. 5 // nullable = true 6 7 default = null 8 } 9 10 // assigning null can still override the default. 11 variable "nullable_non_null_default" { 12 nullable = true 13 default = "ok" 14 } 15 16 // required, and assigning null is valid. 17 variable "nullable_no_default" { 18 nullable = true 19 } 20 21 22 // this combination is invalid 23 //variable "non_nullable_null_default" { 24 // nullable = false 25 // default = null 26 //} 27 28 29 // assigning null will take the default 30 variable "non_nullable_default" { 31 nullable = false 32 default = "ok" 33 } 34 35 // required, but null is not a valid value 36 variable "non_nullable_no_default" { 37 nullable = false 38 } 39 40 output "nullable_null_default" { 41 value = var.nullable_null_default 42 } 43 44 output "nullable_non_null_default" { 45 value = var.nullable_non_null_default 46 } 47 48 output "nullable_no_default" { 49 value = var.nullable_no_default 50 } 51 52 output "non_nullable_default" { 53 value = var.non_nullable_default 54 } 55 56 output "non_nullable_no_default" { 57 value = var.non_nullable_no_default 58 } 59