Using the timeout schema helper to make alb timeout cofigurable

This commit is contained in:
Andy Chan 2017-05-10 16:35:28 -07:00 committed by Paul Stack
parent 1b2055dfa5
commit dc2835d84f
1 changed files with 12 additions and 4 deletions

View File

@ -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 {