Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Final retries after timeouts in docdb resources #9696

Merged
merged 1 commit into from
Aug 12, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions aws/resource_aws_docdb_cluster_instance.go
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,9 @@ func resourceAwsDocDBClusterInstanceCreate(d *schema.ResourceData, meta interfac
}
return nil
})
if isResourceTimeoutError(err) {
resp, err = conn.CreateDBInstance(createOpts)
}
if err != nil {
return fmt.Errorf("error creating DocDB Instance: %s", err)
}
Expand Down Expand Up @@ -356,6 +359,9 @@ func resourceAwsDocDBClusterInstanceUpdate(d *schema.ResourceData, meta interfac
}
return nil
})
if isResourceTimeoutError(err) {
_, err = conn.ModifyDBInstance(req)
}
if err != nil {
return fmt.Errorf("Error modifying DB Instance %s: %s", d.Id(), err)
}
Expand Down
12 changes: 11 additions & 1 deletion aws/resource_aws_docdb_cluster_parameter_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ func waitForDocDBClusterParameterGroupDeletion(conn *docdb.DocDB, name string) e
DBClusterParameterGroupName: aws.String(name),
}

return resource.Retry(10*time.Minute, func() *resource.RetryError {
err := resource.Retry(10*time.Minute, func() *resource.RetryError {
_, err := conn.DescribeDBClusterParameterGroups(params)

if isAWSErr(err, docdb.ErrCodeDBParameterGroupNotFoundFault, "") {
Expand All @@ -279,4 +279,14 @@ func waitForDocDBClusterParameterGroupDeletion(conn *docdb.DocDB, name string) e

return resource.RetryableError(fmt.Errorf("DocDB Parameter Group (%s) still exists", name))
})
if isResourceTimeoutError(err) {
_, err = conn.DescribeDBClusterParameterGroups(params)
if isAWSErr(err, docdb.ErrCodeDBParameterGroupNotFoundFault, "") {
return nil
}
}
if err != nil {
return fmt.Errorf("Error deleting DocDB cluster parameter group: %s", err)
}
return nil
}
12 changes: 11 additions & 1 deletion aws/resource_aws_docdb_subnet_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ func waitForDocDBSubnetGroupDeletion(conn *docdb.DocDB, name string) error {
DBSubnetGroupName: aws.String(name),
}

return resource.Retry(10*time.Minute, func() *resource.RetryError {
err := resource.Retry(10*time.Minute, func() *resource.RetryError {
_, err := conn.DescribeDBSubnetGroups(params)

if isAWSErr(err, docdb.ErrCodeDBSubnetGroupNotFoundFault, "") {
Expand All @@ -216,4 +216,14 @@ func waitForDocDBSubnetGroupDeletion(conn *docdb.DocDB, name string) error {

return resource.RetryableError(fmt.Errorf("DocDB Subnet Group (%s) still exists", name))
})
if isResourceTimeoutError(err) {
_, err = conn.DescribeDBSubnetGroups(params)
if isAWSErr(err, docdb.ErrCodeDBSubnetGroupNotFoundFault, "") {
return nil
}
}
if err != nil {
return fmt.Errorf("Error deleting DocDB subnet group: %s", err)
}
return nil
}