Prototyping for pulumi/pulumi#12709
The approach demonstrated here introduces a codegen option XReturnPlainResource for methods. A resource provider can then use this option to build a method that returns an explicitly configured Provider Resource.
Usage is demonstrated in examples:
There are also some slides on the wider problem.
The implementaion of the method can be found in configurer.go.
Unfortunately YAML usage is blocked by pulumi/pulumi-yaml#354 but will be doable once YAML runtime supports method calls.