From 241fc5bb395552a371113732e6101ad731da0457 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 14 Jan 2015 09:32:03 -0800 Subject: [PATCH] helper/schema: diff floats properly /cc @phinze - This is pretty straightforward, almost magically so. The reason this works is because in `diffString` we use mapstructure[1] with "weak decode mode" to just be responisble for turning anything into a string. [1]: https://github.com/mitchellh/mapstructure --- helper/schema/schema.go | 2 ++ helper/schema/schema_test.go | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/helper/schema/schema.go b/helper/schema/schema.go index e476e8039..752687d54 100644 --- a/helper/schema/schema.go +++ b/helper/schema/schema.go @@ -466,6 +466,8 @@ func (m schemaMap) diff( fallthrough case TypeInt: fallthrough + case TypeFloat: + fallthrough case TypeString: err = m.diffString(k, schema, diff, d, all) case TypeList: diff --git a/helper/schema/schema_test.go b/helper/schema/schema_test.go index 91e7ed9ec..c9b2821f2 100644 --- a/helper/schema/schema_test.go +++ b/helper/schema/schema_test.go @@ -1790,7 +1790,7 @@ func TestSchemaMap_Diff(t *testing.T) { Diff: &terraform.InstanceDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{ - "port": &terraform.ResourceAttrDiff{ + "some_threshold": &terraform.ResourceAttrDiff{ Old: "567.8", New: "12.34", },