How to create a Dynamic Resource Provider for OpensearchTypeScript
Pulumi does not have a built-in provider specifically for OpenSearch Service. However, Pulumi does provide a way to manage resources that do not have first-class providers via dynamic providers.
A Dynamic Resource Provider is defined by implementing the methods of the
pulumi.dynamic.ResourceProviderinterface. Those methods are:
check: This method takes the proposed set of resource inputs and returns the inputs after they've been validated and potentially defaulted. This is an optional method.
diff: This method is called when a resource update is being performed. This is an optional method.
create: This method is called upon resource creation.
read: This method is called to read the state of a resource.
update: This method is called to update an existing resource.
delete: This method is called when a resource is deleted.
Here's a basic example of a dynamic provider for OpenSearch. This doesn't do anything practical, but serves as a sample to the structure.
In this case, you'd replace the comments in the
createmethod with code that actually creates an OpenSearch instance, possibly using an SDK provided by your cloud provider. The
outValuevariables are stand-ins for any output values returned when creating your resource.
Notice this doesn't do anything to manage changes to the resource (i.e.
update), check inputs, or clean up the resource when it's unneeded (i.e.
delete). Expansion on these items would depend on the OpenSearch service and SDK you're using.
It's extremely important to ensure any sensitive data (like credentials) are marked as such so they are appropriately encrypted. When returning these in
update, use the
For complete management of OpenSearch via Pulumi, writing a new Pulumi provider would be more suitable, but is much more involved and goes beyond this introductory view.