fix: type defaults for variables in tests (#2244)

Signed-off-by: ollevche <ollevche@gmail.com>
This commit is contained in:
Oleksandr Levchenkov
2024-12-04 16:48:08 +02:00
committed by GitHub
parent e5d26f9a71
commit 32ca523689
4 changed files with 31 additions and 0 deletions

View File

@@ -3,3 +3,10 @@ variable "input" {
type = string
default = "Hello, world!"
}
variable "another_input" {
type = object({
optional_string = optional(string, "type_default")
optional_number = optional(number, 42)
})
}

View File

@@ -4,4 +4,20 @@ run "applies_defaults" {
condition = var.input == "Hello, world!"
error_message = "should have applied default value"
}
variables {
another_input = {
optional_string = "Hello, world!"
}
}
assert {
condition = var.another_input.optional_string == "Hello, world!"
error_message = "should have used custom value from test file"
}
assert {
condition = var.another_input.optional_number == 42
error_message = "should have used default type value"
}
}