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

Propagate parent and providers for go SDK calls #3563

Merged
merged 6 commits into from
Nov 26, 2019

Conversation

EvanBoyle
Copy link
Contributor

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, and ReadResource.

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 use assert.Same to verify pointer equality.

sdk/go/pulumi/context.go Outdated Show resolved Hide resolved
sdk/go/pulumi/context.go Outdated Show resolved Hide resolved
@@ -531,6 +617,13 @@ func (ctx *Context) getOpts(opts ...ResourceOpt) (URN, []URN, bool, string, bool
}
}

providers := mergeProviders(t, opts...)
Copy link
Member

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.

Copy link
Contributor Author

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.

Copy link
Contributor Author

@EvanBoyle EvanBoyle Nov 26, 2019

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

@EvanBoyle EvanBoyle merged commit 1ca50d4 into master Nov 26, 2019
@pulumi-bot pulumi-bot deleted the evan/goSDKParentSupport branch November 26, 2019 21:23
@EvanBoyle EvanBoyle mentioned this pull request Nov 26, 2019
24 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Go: Invoke calls should allow passing parent
2 participants