mirror of https://github.com/hashicorp/terraform
Handle null outputs in Terraform test files (#33781)
parent
89aa28bfc4
commit
802d49a9ca
@ -0,0 +1,8 @@
|
||||
|
||||
variable "input" {
|
||||
type = number
|
||||
}
|
||||
|
||||
output "output" {
|
||||
value = var.input > 5 ? var.input : null
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
|
||||
run "first" {
|
||||
variables {
|
||||
input = 2
|
||||
}
|
||||
|
||||
assert {
|
||||
condition = output.output == null
|
||||
error_message = "output should have been null"
|
||||
}
|
||||
}
|
||||
|
||||
run "second" {
|
||||
variables {
|
||||
input = 8
|
||||
}
|
||||
|
||||
assert {
|
||||
condition = output.output == 8
|
||||
error_message = "output should have been 8"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in new issue