-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
In resource_google_project: Fix one bug with retries to Projects.Update(...) and add retries to GetBillingInfo(...) requests #5578
Conversation
Failing check does not appear to be related to this change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple small comments, otherwise LGTM.
google/resource_google_project.go
Outdated
@@ -429,7 +432,12 @@ func updateProjectBillingAccount(d *schema.ResourceData, config *Config) error { | |||
if name != "" { | |||
ba.BillingAccountName = "billingAccounts/" + name | |||
} | |||
_, err := config.clientBilling.Projects.UpdateBillingInfo(prefixedProject(pid), ba).Do() | |||
updateBillingInfoFunc := func() error { | |||
var err error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: this is equivalent to _, err := config.clientBilling.Projects.UpdateBillingInfo(prefixedProject(pid), ba).Do()
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think it is the same. I think that there is some worry about the value for 'err' persisting past the function closure (if err was actually declared before the function), but I am not even sure if that would happen if there was an 'err' defined before this function.
Will change.
…te(...) and add retries to GetBillingInfo(...) requests This change affects two areas:: 1. When the result of a Projects.Update(...) request is an error, the returned 'project' value is 'nil'. Previously, this value was stored in 'p' which was then dereferenced when retrieving 'p.ProjectId' on the subsequent retry. This fix only allows 'p' to be overwritten if the Projects.Update(...) request is successful. 2. Requests to the BillingInfo service could fail due to transient HTTP timeouts (usually TLS handshake negotiation timeout) and for throttling (HTTP 429). Adding retries addresses this.
Updated post comments. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! I'll upstream to MM.
I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues. If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 hashibot-feedback@hashicorp.com. Thanks! |
This change affects two areas::
'project' value is 'nil'. Previously, this value was stored in 'p' which
was then dereferenced when retrieving 'p.ProjectId' on the subsequent retry.
This fix only allows 'p' to be overwritten if the Projects.Update(...)
request is successful.
(usually TLS handshake negotiation timeout) and for throttling (HTTP
429). Adding retries addresses this.