Terraform
Float64 Known Value Checks
The known value checks that are available for float64 values are:
Float64Exact
Check
The Float64Exact check tests that a resource attribute, or output value has an exactly matching float64 value.
Example usage of Float64Exact in an ExpectKnownValue plan check.
func TestExpectKnownValue_CheckPlan_Float64(t *testing.T) {
t.Parallel()
resource.Test(t, resource.TestCase{
// Provider definition omitted.
Steps: []resource.TestStep{
{
// Example resource containing a computed float64 attribute named "computed_attribute"
Config: `resource "test_resource" "one" {}`,
ConfigPlanChecks: resource.ConfigPlanChecks{
PreApply: []plancheck.PlanCheck{
plancheck.ExpectKnownValue(
"test_resource.one",
tfjsonpath.New("computed_attribute"),
knownvalue.Float64Exact(1.23),
),
},
},
},
},
})
}