I was hoping to get some advice on how to use Pulumi to spin up Google Cloud Endpoints with OpenAPI auth (https://cloud.google.com/endpoints/docs/openapi/get-started-cloud-functions#reserve_hostname
). The hard part is that it's a few steps and involves replacing
a resource. Specifically, step 1 is to run something
via Google's cloud run. It doesn't matter what container is run at this point; all that matters is we're "reserving" a unique hostname for our eventual cloud run service. Then we use the uniquely assigned hostname to create a text file that defines the routing and auth, then we include that generated text file in a docker image, and finally we replace
the initial cloud run service with this new container.
Since Pulumi's model is generally describe what you want and Pulumi will "make it so" this doesn't map neatly as we have to create a cloud run service that is temporary
and we don't want it running when we're all done. The best idea I've come up with so far is a custom, dynamic resource provider that will create the temporary cloud run service and then "lie" in its
method and such so that if it's been replaced it says not changes need to happen. I got that mostly working but it seems you can't use
to create the temporary service inside the custom provider (I get an error that says, "Program run without the Pulumi engine available; re-run using the
CLI" even though it was run via
). Even if I could use
I don't see a way to destroy the resource created in the
is called. So I can make this work with native API calls or Google's own Python SDK but that all seems like more work than should be necessary. Is there a clean way to do this?