From dc2835d84f7886c3ddc01b335bc834e6e3835c2e Mon Sep 17 00:00:00 2001 From: Andy Chan Date: Wed, 10 May 2017 16:35:28 -0700 Subject: [PATCH] Using the timeout schema helper to make alb timeout cofigurable --- builtin/providers/aws/resource_aws_alb.go | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/builtin/providers/aws/resource_aws_alb.go b/builtin/providers/aws/resource_aws_alb.go index fe94dd0fa1..d1652c6804 100644 --- a/builtin/providers/aws/resource_aws_alb.go +++ b/builtin/providers/aws/resource_aws_alb.go @@ -24,6 +24,12 @@ func resourceAwsAlb() *schema.Resource { State: schema.ImportStatePassthrough, }, + Timeouts: &schema.ResourceTimeout{ + Create: schema.DefaultTimeout(10 * time.Minute), + Update: schema.DefaultTimeout(10 * time.Minute), + Delete: schema.DefaultTimeout(10 * time.Minute), + }, + Schema: map[string]*schema.Schema{ "arn": { Type: schema.TypeString, @@ -203,8 +209,9 @@ func resourceAwsAlbCreate(d *schema.ResourceData, meta interface{}) error { return describeResp, *dLb.State.Code, nil }, - Timeout: 10 * time.Minute, - MinTimeout: 3 * time.Second, + Timeout: d.Timeout(schema.TimeoutCreate), + MinTimeout: 10 * time.Second, + Delay: 30 * time.Second, // Wait 30 secs before starting } _, err = stateConf.WaitForState() if err != nil { @@ -369,8 +376,9 @@ func resourceAwsAlbUpdate(d *schema.ResourceData, meta interface{}) error { return describeResp, *dLb.State.Code, nil }, - Timeout: 10 * time.Minute, - MinTimeout: 3 * time.Second, + Timeout: d.Timeout(schema.TimeoutUpdate), + MinTimeout: 10 * time.Second, + Delay: 30 * time.Second, // Wait 30 secs before starting } _, err := stateConf.WaitForState() if err != nil {