pulumi-cloud icon indicating copy to clipboard operation
pulumi-cloud copied to clipboard

Allow `Input<T>` on most/all input parameters on Service and other APIs

Open lukehoban opened this issue 7 years ago • 4 comments

A concrete example from a user was the Docker build args parameter to new Service(). The following code doesn't work currently, but we should be able to support this:

export let apiEndpoint = deployment.invokeUrl.apply(url => url + deployment.stageName);

let nginxService = new cloudAws.Service("nginx", {
    containers: {
        nginx: {
            build: {
                context: "./nginx",
                args: {
                    "API_URL": apiEndpoint,
                    "FRONTEND_URL": frontendUrl
                }
            },
            memory: 256,
            ports: [{port: 443, external: true, protocol: "https"}]
        }
    },
    replicas: 3
});

lukehoban avatar Oct 18 '18 21:10 lukehoban

A other concrete case that a customer ran into - allowing image to be an Input<string> so that it can be composed with new docker.Image(...) more easily.

lukehoban avatar Nov 19 '18 05:11 lukehoban

This was fixed for image: with https://github.com/pulumi/pulumi-cloud/pull/660. We'll tackle others in M20.

lukehoban avatar Nov 20 '18 17:11 lukehoban

This is non-trivial currently due to the fact that build-args are used as part of our computation of the repository name we want to generate.

Potential solutions currently are:

  1. remove build-args from repo-name genertion. though this might mean potential collisions of docker builds where the args are different.
  2. allow build-args to be computed, but require the user to supply a repository-name option themselves if they are computed.
  3. Something else?

@lukehoban Any thoughts here on a preferred direction to go? Is there another option you think we could potentially take here?

CyrusNajmabadi avatar Jan 23 '19 19:01 CyrusNajmabadi

Another approach we're taking is simply to remove the cachign layers provided here (i.e. we cache multiple docker builds that have the exact same build comamnd). With the knowledge that this means that consumers that want this sort of non-rebuilding logic would need to pull out that caching themselves.

CyrusNajmabadi avatar Jan 23 '19 21:01 CyrusNajmabadi