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
This commit is contained in:
Mitchell Hashimoto 2015-01-14 09:32:03 -08:00
parent 6fadebc5d8
commit 241fc5bb39
2 changed files with 3 additions and 1 deletions

View File

@ -466,6 +466,8 @@ func (m schemaMap) diff(
fallthrough fallthrough
case TypeInt: case TypeInt:
fallthrough fallthrough
case TypeFloat:
fallthrough
case TypeString: case TypeString:
err = m.diffString(k, schema, diff, d, all) err = m.diffString(k, schema, diff, d, all)
case TypeList: case TypeList:

View File

@ -1790,7 +1790,7 @@ func TestSchemaMap_Diff(t *testing.T) {
Diff: &terraform.InstanceDiff{ Diff: &terraform.InstanceDiff{
Attributes: map[string]*terraform.ResourceAttrDiff{ Attributes: map[string]*terraform.ResourceAttrDiff{
"port": &terraform.ResourceAttrDiff{ "some_threshold": &terraform.ResourceAttrDiff{
Old: "567.8", Old: "567.8",
New: "12.34", New: "12.34",
}, },