Merge pull request #19312 from hashicorp/b-undefined-timeout

helper/schema: Avoid erroring out on undefined timeouts
This commit is contained in:
Radek Simko 2018-11-07 17:07:38 +00:00 committed by GitHub
commit 4b04e31dd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 3 deletions

View File

@ -5,6 +5,7 @@ import (
"log" "log"
"time" "time"
"github.com/hashicorp/terraform/config"
"github.com/hashicorp/terraform/terraform" "github.com/hashicorp/terraform/terraform"
"github.com/mitchellh/copystructure" "github.com/mitchellh/copystructure"
) )
@ -105,10 +106,16 @@ func (t *ResourceTimeout) ConfigDecode(s *Resource, c *terraform.ResourceConfig)
*timeout = rt *timeout = rt
} }
} else { return nil
log.Printf("[ERROR] Invalid timeout structure: %T", raw)
return fmt.Errorf("Invalid Timeout structure found")
} }
if v, ok := raw.(string); ok && v == config.UnknownVariableValue {
// Timeout is not defined in the config
// Defaults will be used instead
return nil
}
log.Printf("[ERROR] Invalid timeout structure: %T", raw)
return fmt.Errorf("Invalid Timeout structure found")
} }
return nil return nil