Skip to content

Commit

Permalink
aws_subnet: Increase timeout for delete to 20 mins
Browse files Browse the repository at this point in the history
We've seen subnet deletion failures that we think we can trace to ENIs left
behind by NLB. We don't have permission to detach or delete those ENIs, so our
only recourse is to wait longer.

Additionally, we plumb through Create and Delete to use the configured timeouts
via `d.Timeout(schema.Timeout{Create,Delete})` so that custom timeouts will be
reflected. Update is not as straightforward to reason about as there are
separate timeouts for disassociation and association of address spaces, and the
individually configured values do not appear to have presented problems so far.
  • Loading branch information
jen20 committed Jun 2, 2019
1 parent b885132 commit dde1073
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions aws/resource_aws_subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func resourceAwsSubnet() *schema.Resource {

Timeouts: &schema.ResourceTimeout{
Create: schema.DefaultTimeout(10 * time.Minute),
Delete: schema.DefaultTimeout(10 * time.Minute),
Delete: schema.DefaultTimeout(20 * time.Minute),
},

SchemaVersion: 1,
Expand Down Expand Up @@ -129,7 +129,7 @@ func resourceAwsSubnetCreate(d *schema.ResourceData, meta interface{}) error {
Pending: []string{"pending"},
Target: []string{"available"},
Refresh: SubnetStateRefreshFunc(conn, *subnet.SubnetId),
Timeout: 10 * time.Minute,
Timeout: d.Timeout(schema.TimeoutCreate),
}

_, err = stateConf.WaitForState()
Expand Down Expand Up @@ -330,7 +330,7 @@ func resourceAwsSubnetDelete(d *schema.ResourceData, meta interface{}) error {
wait := resource.StateChangeConf{
Pending: []string{"pending"},
Target: []string{"destroyed"},
Timeout: 10 * time.Minute,
Timeout: d.Timeout(schema.TimeoutDelete),
MinTimeout: 1 * time.Second,
Refresh: func() (interface{}, string, error) {
_, err := conn.DeleteSubnet(req)
Expand Down

0 comments on commit dde1073

Please sign in to comment.