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

return nil instead of op, which is an interface containing nil #2808

Merged

Conversation

megan07
Copy link
Contributor

@megan07 megan07 commented Dec 10, 2019

Fixes hashicorp/terraform-provider-google#5114

The issue here seems to be that op is an interface containing nil rather than nil. So, when checking if op == nil further in the code, to see if it should retry, op evaluates to not nil and hits the else, expecting the resource to be found (https://github.com/hashicorp/terraform-plugin-sdk/blob/master/helper/resource/state.go#L126).

This may explain it better: https://golang.org/doc/faq#nil_error

I'm not sure if it's always safe to assume that op will always be nil here, but it seems as though we want to retry, and in order to retry, this will need to return nil. However, with that logic, maybe line 134 should also return nil instead of op?

all: fixed an issue where operation retries were suppressed

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 8cc3d7d.

Pull request statuses

No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I built this PR into one or more new PRs on other repositories, and when those are closed, this PR will also be merged and closed.
depends: hashicorp/terraform-provider-google-beta#1494
depends: GoogleCloudPlatform/terraform-google-conversion#284
depends: hashicorp/terraform-provider-google#5134

Copy link
Member

@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.

This + modifying L134 seem correct to me. I'm curious if we ever expected to get non-nil op values returned when err wasn't nil. Most QueryOp implementations are just passing on another function's return, unfortunately.

@modular-magician
Copy link
Collaborator

Hi! I'm the modular magician, I work on Magic Modules.
I see that this PR has already had some downstream PRs generated. Any open downstreams are already updated to your most recent commit, 5d49869.

Pull request statuses

terraform-provider-google-beta already has an open PR.
terraform-google-conversion already has an open PR.
terraform-provider-google already has an open PR.
No diff detected in Ansible.
No diff detected in Inspec.

New Pull Requests

I didn't open any new pull requests because of this PR.

megan07 and others added 3 commits December 10, 2019 19:55
@modular-magician modular-magician merged commit 73f2f1a into GoogleCloudPlatform:master Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GCE Operations return an unintuitive error on timeouts
4 participants