return nil instead of op, which is an interface containing nil #2808
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes hashicorp/terraform-provider-google#5114
The issue here seems to be that
op
is an interface containingnil
rather thannil
. So, when checking ifop == nil
further in the code, to see if it should retry,op
evaluates to notnil
and hits theelse
, 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 returnnil
instead ofop
?