Using timeout schema helper for RDS cluster resource lifecycle mgmt

This commit is contained in:
Andy Chan 2017-05-10 16:06:13 -07:00 committed by Paul Stack
parent 4c8b382936
commit cb1b2acc97
1 changed files with 15 additions and 7 deletions

View File

@ -24,6 +24,12 @@ func resourceAwsRDSCluster() *schema.Resource {
State: resourceAwsRdsClusterImport,
},
Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(120 * time.Minute),
Update: schema.DefaultTimeout(120 * time.Minute),
Delete: schema.DefaultTimeout(120 * time.Minute),
},
Schema: map[string]*schema.Schema{
"availability_zones": {
@ -305,9 +311,9 @@ func resourceAwsRDSClusterCreate(d *schema.ResourceData, meta interface{}) error
Pending: []string{"creating", "backing-up", "modifying"},
Target: []string{"available"},
Refresh: resourceAwsRDSClusterStateRefreshFunc(d, meta),
Timeout: 120 * time.Minute,
MinTimeout: 3 * time.Second,
Delay: 30 * time.Second, // Wait 30 secs before starting
Timeout: d.Timeout(schema.TimeoutCreate),
MinTimeout: 10 * time.Second,
Delay: 30 * time.Second,
}
// Wait, catching any errors
@ -458,8 +464,9 @@ func resourceAwsRDSClusterCreate(d *schema.ResourceData, meta interface{}) error
Pending: []string{"creating", "backing-up", "modifying"},
Target: []string{"available"},
Refresh: resourceAwsRDSClusterStateRefreshFunc(d, meta),
Timeout: 120 * time.Minute,
MinTimeout: 3 * time.Second,
Timeout: d.Timeout(schema.TimeoutCreate),
MinTimeout: 10 * time.Second,
Delay: 30 * time.Second,
}
// Wait, catching any errors
@ -660,8 +667,9 @@ func resourceAwsRDSClusterDelete(d *schema.ResourceData, meta interface{}) error
Pending: []string{"available", "deleting", "backing-up", "modifying"},
Target: []string{"destroyed"},
Refresh: resourceAwsRDSClusterStateRefreshFunc(d, meta),
Timeout: 15 * time.Minute,
MinTimeout: 3 * time.Second,
Timeout: d.Timeout(schema.TimeoutDelete),
MinTimeout: 10 * time.Second,
Delay: 30 * time.Second,
}
// Wait, catching any errors