I need a way of ensuring some services have been stood up and their URLs formalised in GCP before I craft an OpenAPI spec - using substitutions. The URLs are relatively dynamic as this environment is torn down nightly.
One solution I have is
import { helloWorldUrl } from './cloud-run/hello-world';
import { anotherHelloWorldUrl } from './cloud-run/another-hello-world-service';
import * as pulumi from '@pulumi/pulumi';
import * as fs from 'fs';
import * as Mustache from 'mustache';
pulumi.all([helloWorldUrl, anotherHelloWorldUrl])
.apply(([hello, another]) => {
let gatewayOpenAPI = fs.readFileSync('./api-gateway/open-api/gateway.yaml').toString();
gatewayOpenAPI = Mustache.render(gatewayOpenAPI, { helloWorldUrl: hello, anotherHelloWorld: another });
fs.writeFileSync(`./api-gateway/open-api/gateway-${pulumi.getStack()}.yaml`, gatewayOpenAPI);
// create api gateway infra here.
// cannot return outputs here :(
});
but this does not allow me to set Outputs. Is there a more elegant solution to this?
Cheers KH