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
Allow component providers to return outputs to the engine #15408
Conversation
Changelog[uncommitted] (2024-02-08)Features
|
82609d3
to
b398705
Compare
ret.ReturnDependencies = map[resource.PropertyKey][]resource.URN{} | ||
} | ||
for k, v := range ret.Return { | ||
ret.ReturnDependencies[k] = addOutputDependencies(ret.ReturnDependencies[k], v) |
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.
This appends to the dependency list, so it's ok for Call to return both, it'll just end up with the same URN duplicated (maybe these should be sets?)
constructResult.OutputDependencies = map[resource.PropertyKey][]resource.URN{} | ||
} | ||
for k, v := range result.State.Outputs { | ||
constructResult.OutputDependencies[k] = addOutputDependencies(constructResult.OutputDependencies[k], v) |
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.
Again this is appending to the deps map so the provider can return the map, or output values, or both.
@@ -1884,3 +1904,31 @@ func downgradeOutputValues(v resource.PropertyMap) resource.PropertyMap { | |||
} | |||
return result | |||
} | |||
|
|||
func addOutputDependencies(deps []resource.URN, v resource.PropertyValue) []resource.URN { |
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.
So tempted to write a reducer for property values
@@ -164,6 +164,8 @@ message CallRequest { | |||
int32 parallel = 11; // the degree of parallelism for resource operations (<=1 for serial). | |||
string monitorEndpoint = 12; // the address for communicating back to the resource monitor. | |||
string organization = 14; // the organization of the stack being deployed into. | |||
|
|||
bool accepts_output_values = 17; // the engine can be passed output values back, returnDependencies can be left blank if returning output values. |
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.
The engine now always sets this to true, but it means providers can use it as a flag for if they can return output values or not because old engines won't have set it (so it defaults to false)
b398705
to
ae1ad75
Compare
ae1ad75
to
384b797
Compare
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.
LGTM
### Features - [components] Component providers can return output values in their response to the engine. [#15408](#15408) - [programgen/{dotnet,go,nodejs,python}] Emit missing trivia for resources and local variables [#15419](#15419) - [sdk/{nodejs,python}] Publish dev versions of the nodejs and python SDKs ### Bug Fixes - [cli] Fix `pulumi destroy` to fill in stack config with the secret config from state, not fresh secret config. [#15432](#15432) - [engine] Engine no longer assumes program dependencies are specified as semantic versions. [#15409](#15409) - [components/go] Component providers now correctly return output values to the engine. [#15405](#15405) ### Miscellaneous - [protobuf] Split CallRequest into ResourceCallRequest for the ResourceMonitor service. [#15404](#15404) - [backend/diy] Add a warning that non-project mode will be deprecated at some point. [#15411](#15411)
Description
This adds a new flag to provider Construct and Call requests to indicate that the engine will accept output values in the response.
If a component provider sees that flag set they can return Output PropertyValues and optionally skip filling in the dependency map in the response.
The engine will use the combined information of the dependency map and any dependencies found on any output values in the property to build the final dependency map that is returned to programs.
Checklist
make tidy
to update any new dependenciesmake lint
to verify my code passes the lint checkgofumpt
make changelog
and committed thechangelog/pending/<file>
documenting my change