Skip to content

Commit

Permalink
Using timeout schema helper for RDS cluster resource lifecycle mgmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Chan authored and stack72 committed May 11, 2017
1 parent 4c8b382 commit cb1b2ac
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions builtin/providers/aws/resource_aws_rds_cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit cb1b2ac

Please sign in to comment.