pulumi / pulumi-java

Java support for Pulumi
Apache License 2.0
69 stars 21 forks source link

Add support for parameterized providers #1398

Closed lunaris closed 2 months ago

lunaris commented 3 months ago

Parameterization refers to the ability for a provider to vary its schema based on a parameter that is passed to a new Parameterize call on the provider interface. The package reference that is returned may then be used to interact with the bespoke schema/packages within. Paramterization is key to e.g. dynamically bridging providers. In this instance we can manage and release a single "bridge" provider that accepts a parameter defining the upstream provider to bridge, and returns a reference to a dynamically constructed package whose schema reflects the upstream as needed.

This commit adds support for creating and reading parameterized resources, as well as calling parameterized Invokes, to the Java SDK. If a package is parameterized, SDK generation is modified to generate a Utilities.getPackageRef static method that lazily makes a RegisterPackage RPC call (using a new method on Deployment). This method is then plumbed in to the SDK's Resource constructors and invoke* methods.