Verify support for returning plain values from YAML methods
Opened this issue ยท 0 comments
Hello!
- Vote on this issue by adding a ๐ reaction
- If you want to implement this feature, comment to let us know (we'll work with you on design, scheduling, etc.)
Issue details
As a provider author I would like to be able to mark methods as plain: true so that my provider's consumers can access their results directly without an Output wrapper.
Further, methods that return a single value only should not be wrapped in a struct, making it as simple as possible to consume.
Methods should be able to return explicit Provider references usable for configuring other resources in the stack, so that methods can be used as factories to simplify complex provider configuration.
Here is a PR implementing plain-valued methods for Node, Python, Go that includes acceptance tests for this feature:
pulumi/pulumi#13592
Borrowing from that PR, the new schema forms is listed below; "tlsProvider" returns a singleton provider reference, "meaningOfLife" returns a singleton integer, and "objectMix" returns both in a struct.
"functions": {
"metaprovider:index:Configurer/tlsProvider": {
"inputs": {
"properties": {
"__self__": {
"$ref": "#/resources/metaprovider:index:Configurer"
}
}
},
"outputs": {
"$ref": "/tls/v4.10.0/schema.json#/provider",
"plain": true
}
},
"metaprovider:index:Configurer/meaningOfLife": {
"inputs": {
"properties": {
"__self__": {
"$ref": "#/resources/metaprovider:index:Configurer"
}
}
},
"outputs": {
"type": "integer",
"plain": true
}
},
"metaprovider:index:Configurer/objectMix": {
"inputs": {
"properties": {
"__self__": {
"$ref": "#/resources/metaprovider:index:Configurer"
}
}
},
"outputs": {
"type": "object",
"plain": true,
"properties": {
"provider": {
"$ref": "/tls/v4.10.0/schema.json#/provider"
},
"meaningOfLife": {
"type": "integer"
}
}
}
}
},
YAML-specific considerations
Since YAML does not require SDK generation and relies on Go SDK under the hood, the feature might just work once Method calls are supported - it is currently blocked on that. However it would be good to verify in particular that the information flows correctly and that provider references returned from factory methods can be used to configure further resources.