Skip to content

Commit

Permalink
Merge pull request #3212 from terraform-providers/b-retry-dx-disassoc
Browse files Browse the repository at this point in the history
resource/aws_dx_connection_association: Retry disassociation
  • Loading branch information
radeksimko authored Feb 1, 2018
2 parents 12d6a39 + 6b848e7 commit 3ade9b1
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions aws/resource_aws_dx_connection_association.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,11 @@ package aws

import (
"fmt"
"time"

"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/service/directconnect"
"github.com/hashicorp/terraform/helper/resource"
"github.com/hashicorp/terraform/helper/schema"
)

Expand Down Expand Up @@ -79,11 +81,14 @@ func resourceAwsDxConnectionAssociationDelete(d *schema.ResourceData, meta inter
LagId: aws.String(d.Get("lag_id").(string)),
}

_, err := conn.DisassociateConnectionFromLag(input)
if err != nil {
return err
}

d.SetId("")
return nil
return resource.Retry(1*time.Minute, func() *resource.RetryError {
_, err := conn.DisassociateConnectionFromLag(input)
if err != nil {
if isAWSErr(err, directconnect.ErrCodeClientException, "is in a transitioning state.") {
return resource.RetryableError(err)
}
return resource.NonRetryableError(err)
}
return nil
})
}

0 comments on commit 3ade9b1

Please sign in to comment.