helper/schema: Guard against a panic if Timeout is not properly

structured
This commit is contained in:
clint shryock 2017-03-07 10:25:32 -06:00
parent b58709aa91
commit aa3677cd89
1 changed files with 42 additions and 39 deletions

View File

@ -61,7 +61,7 @@ func (t *ResourceTimeout) ConfigDecode(s *Resource, c *terraform.ResourceConfig)
} }
if raw, ok := c.Config["timeout"]; ok { if raw, ok := c.Config["timeout"]; ok {
configTimeouts := raw.([]map[string]interface{}) if configTimeouts, ok := raw.([]map[string]interface{}); ok {
for _, timeoutValues := range configTimeouts { for _, timeoutValues := range configTimeouts {
// loop through each Timeout given in the configuration and validate they // loop through each Timeout given in the configuration and validate they
// the Timeout defined in the resource // the Timeout defined in the resource
@ -108,6 +108,9 @@ func (t *ResourceTimeout) ConfigDecode(s *Resource, c *terraform.ResourceConfig)
*timeout = rt *timeout = rt
} }
} }
} else {
log.Printf("[WARN] Invalid Timeout structure found, skipping timeouts")
}
} }
return nil return nil