The simplest thing would be to use dynamic providers: https://www.pulumi.com/docs/intro/concepts/programming-model/#dynamicproviders
You could also build a standalone Pulumi Resource Provider (similar to how the Pulumi kubernetes provider is built for example), but that is not well documented currently - and is probably 1-2 orders of magnitude more work than a dynamic provider.