diff --git a/helper/schema/provider_test.go b/helper/schema/provider_test.go index 0524a6934..01ee82a1f 100644 --- a/helper/schema/provider_test.go +++ b/helper/schema/provider_test.go @@ -269,7 +269,6 @@ func TestProviderValidate(t *testing.T) { } } -/* FIXME Invalid timeout structure: []interface {}{map[string]interface {}{"create":"40m"}} func TestProviderDiff_legacyTimeoutType(t *testing.T) { p := &Provider{ ResourcesMap: map[string]*Resource{ @@ -307,7 +306,6 @@ func TestProviderDiff_legacyTimeoutType(t *testing.T) { t.Fatal(err) } } -*/ func TestProviderDiff_timeoutInvalidValue(t *testing.T) { p := &Provider{ diff --git a/helper/schema/resource_timeout.go b/helper/schema/resource_timeout.go index 222b2cc91..1a15a0ebd 100644 --- a/helper/schema/resource_timeout.go +++ b/helper/schema/resource_timeout.go @@ -78,6 +78,16 @@ func (t *ResourceTimeout) ConfigDecode(s *Resource, c *terraform.ResourceConfig) log.Printf("[ERROR] Invalid timeout value: %q", raw) return fmt.Errorf("Invalid Timeout value found") } + case []interface{}: + for _, r := range raw { + if rMap, ok := r.(map[string]interface{}); ok { + rawTimeouts = append(rawTimeouts, rMap) + } else { + // Go will not allow a fallthrough + log.Printf("[ERROR] Invalid timeout structure: %#v", raw) + return fmt.Errorf("Invalid Timeout structure found") + } + } default: log.Printf("[ERROR] Invalid timeout structure: %#v", raw) return fmt.Errorf("Invalid Timeout structure found") diff --git a/helper/schema/resource_timeout_test.go b/helper/schema/resource_timeout_test.go index 9f2da9546..e53bbd849 100644 --- a/helper/schema/resource_timeout_test.go +++ b/helper/schema/resource_timeout_test.go @@ -122,7 +122,6 @@ func TestResourceTimeout_ConfigDecode(t *testing.T) { } } -/* FIXME Expected good timeout returned:, Invalid Timeout structure found func TestResourceTimeout_legacyConfigDecode(t *testing.T) { r := &Resource{ Timeouts: &ResourceTimeout{ @@ -158,7 +157,6 @@ func TestResourceTimeout_legacyConfigDecode(t *testing.T) { t.Fatalf("bad timeout decode.\nExpected:\n%#v\nGot:\n%#v\n", expected, timeout) } } -*/ func TestResourceTimeout_DiffEncode_basic(t *testing.T) { cases := []struct {