From 0cbf745e5a7fda69eca0177431aec3011b9830bf Mon Sep 17 00:00:00 2001 From: Radek Simko Date: Wed, 7 Nov 2018 15:28:16 +0000 Subject: [PATCH] helper/schema: Avoid erroring out on undefined timeouts --- helper/schema/resource_timeout.go | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/helper/schema/resource_timeout.go b/helper/schema/resource_timeout.go index 33cbce185..b7d63fafa 100644 --- a/helper/schema/resource_timeout.go +++ b/helper/schema/resource_timeout.go @@ -5,6 +5,7 @@ import ( "log" "time" + "github.com/hashicorp/terraform/config" "github.com/hashicorp/terraform/terraform" "github.com/mitchellh/copystructure" ) @@ -105,10 +106,16 @@ func (t *ResourceTimeout) ConfigDecode(s *Resource, c *terraform.ResourceConfig) *timeout = rt } - } else { - log.Printf("[ERROR] Invalid timeout structure: %T", raw) - return fmt.Errorf("Invalid Timeout structure found") + return nil } + 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