-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Propagate parent and providers for go SDK calls #3563
Conversation
sdk/go/pulumi/context.go
Outdated
@@ -531,6 +617,13 @@ func (ctx *Context) getOpts(opts ...ResourceOpt) (URN, []URN, bool, string, bool | |||
} | |||
} | |||
|
|||
providers := mergeProviders(t, opts...) |
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.
Feels like we should just pull this off of *ResourceState
rather than recomputing it.
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.
Done. Thanks for pointing this out. I imagine the concern here is perf related, as piping through the additional parameter through two functions is a little ugly? Looking more closely, we're computing a set of sync and async properties, and we should probably have prepareOpts
functions for each to make this a little cleaner.
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.
(It's been a minute since I had to worry at object allocation level perf, so I appreciate helping me get up to speed here.)
…oSDKParentSupport
Fixes #3494
I added support to propagate a parent in
Invoke
calls. If specified, parent is used as a backstop to lookup providers for the operation.While I was in this space, I also did the same for
RegisterResource
, andReadResource
.ReadResource
has a bug in the API that is blocking me from writing the proper tests #3562. I'll be addressing that bug and adding the appropriate tests in another PR.I had to update the version of
assert
in order to useassert.Same
to verify pointer equality.