terraform/internal/stacks/stackruntime/testdata/mainbundle/test/checkable-objects/checkable-objects.tf
CJ Horton 5a750561e6 round-trip check results through stack plans
Components expect that check results will be round-tripped
through the plan in order to update unknown check results
during the apply. We hadn't wired this up for stack plans,
resulting in panics when the apply tries to update a check
status that doesn't exist.
2024-03-01 17:22:44 -08:00

35 lines
No EOL
616 B
HCL

terraform {
required_providers {
testing = {
source = "hashicorp/testing"
version = "0.1.0"
}
}
}
variable "foo" {
type = string
validation {
condition = length(var.foo) > 0
error_message = "input must not be empty"
}
}
resource "testing_resource" "main" {
id = "test"
value = var.foo
lifecycle {
postcondition {
condition = length(self.value) > 0
error_message = "value must not be empty"
}
}
}
check "value_is_baz" {
assert {
condition = testing_resource.main.value == "baz"
error_message = "value must be 'baz'"
}
}