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

In resource_google_project: Fix one bug with retries to Projects.Update(...) and add retries to GetBillingInfo(...) requests #5578

Merged
merged 1 commit into from
Feb 7, 2020

Conversation

spew
Copy link
Contributor

@spew spew commented Feb 4, 2020

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.
resourcemanager: fixed retry behavior for updates in `google_project`, added retries for billing metadata requests

@ghost ghost added the size/s label Feb 4, 2020
@ghost ghost requested review from megan07 and paddycarver February 4, 2020 16:56
@spew
Copy link
Contributor Author

spew commented Feb 4, 2020

Failing check does not appear to be related to this change.

Copy link
Collaborator

@rileykarson rileykarson left a 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 Show resolved Hide resolved
@@ -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
Copy link
Collaborator

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?

Copy link
Contributor Author

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.

google/resource_google_project.go Show resolved Hide resolved
…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.
@spew
Copy link
Contributor Author

spew commented Feb 6, 2020

Updated post comments.

Copy link
Collaborator

@rileykarson rileykarson left a 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.

@ghost
Copy link

ghost commented Mar 28, 2020

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!

@ghost ghost locked and limited conversation to collaborators Mar 28, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants