Terraform
NotNull Known Value Checks
The known value checks that are available for values that are not null are:
NotNull
Check
The NotNull check tests that a resource attribute, or output value is not null (i.e., any known value).
Example usage of NotNull in an ExpectKnownValue state check.
func TestExpectKnownValue_CheckState_AttributeValueNull(t *testing.T) {
t.Parallel()
r.Test(t, r.TestCase{
// Provider definition omitted.
Steps: []r.TestStep{
{
// Example resource containing a computed attribute named "computed_attribute"
Config: `resource "test_resource" "one" {}`,
ConfigStateChecks: []statecheck.StateCheck{
statecheck.ExpectKnownValue(
"test_resource.one",
tfjsonpath.New("computed_attribute"),
knownvalue.NotNull(),
),
},
},
},
})
}