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

Add compute_route retry for "peering operation in progress" #3518

Merged
merged 1 commit into from
May 18, 2020
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
1 change: 1 addition & 0 deletions products/compute/terraform.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1680,6 +1680,7 @@ overrides: !ruby/object:Overrides::ResourceOverrides
Route: !ruby/object:Overrides::Terraform::ResourceOverride
# Route cannot be added while a peering is on progress on the network
mutex: 'projects/{{project}}/global/networks/{{network}}/peerings'
error_retry_predicates: ["isPeeringOperationInProgress"]
examples:
- !ruby/object:Provider::Terraform::Examples
name: "route_basic"
Expand Down
9 changes: 9 additions & 0 deletions third_party/terraform/utils/error_retry_predicates.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,3 +248,12 @@ func isDataflowJobUpdateRetryableError(err error) (bool, string) {
}
return false, ""
}

func isPeeringOperationInProgress(err error) (bool, string) {
if gerr, ok := err.(*googleapi.Error); ok {
if gerr.Code == 400 && strings.Contains(gerr.Body, "There is a peering operation in progress") {
return true, "Waiting peering operation to complete"
}
}
return false, ""
}