bored-nightfall-11601
09/23/2024, 9:39 PMimport * as docker from "@pulumi/docker";
const ubuntu = new docker.RemoteImage("ubuntu", {
name: "ubuntu:precise"
});
const val = ubuntu.build.apply(_ => "ubuntu:precise")
const ubuntu2 = new docker.RemoteImage("ubuntu2", {
name: val
});
works not as expected. Because build is null, during preview name of the second ubuntu will be always unknown. Are there any tickets regarding making null
and notyetcomputed
values different during preview? That code above ends with infinite cycle where there is one value to replace during preview that is untouched during actual run:
Enter your passphrase to unlock config/secrets
Previewing update (dev):
Type Name Plan Info
pulumi:pulumi:Stack pulumi-ts-test-dev
+- └─ docker:index:RemoteImage ubuntu2 replace [diff: ~name]
Resources:
+-1 to replace
2 unchanged
Do you want to perform this update? yes
Updating (dev):
Type Name Status
pulumi:pulumi:Stack pulumi-ts-test-dev
Resources:
3 unchanged
Duration: 2s
little-cartoon-10569
09/23/2024, 9:48 PMRemoteImage.build
is an input, it's used for passing command line parameters to the Docker CLI.
Calling apply
on it is using it as an output: you're looking up what values were passed to the CLI back when it was called.
You're then taking the object containing all those parameters, ignoring it, and returning the value "ubuntu:precise". So val
will always be an Output wrapping "ubuntu:precise". That's essentially hard-coded.
What is it that you are hoping to do, and I'll help you write code that does that.bored-nightfall-11601
09/23/2024, 11:29 PMnotyetcomputed
and null
values during preview (grpc server just seems to return nothing - as in struct field does not exist at all - in both cases). From this examples it seems that official languages also cannot differentiate - during preview all nulls become notyetcomputed
values.
I found example that use only outputs:
import * as docker from "@pulumi/docker";
const container = new docker.Container("cont", {
image: "sha256:e4c58958181a5925816faa528ce959e487632f4cfd192f8132f71b32df2744b4",
networkMode: "bridge",
command: ["sleep", "10000"],
})
const val = container.containerLogs.apply(_ => "ubuntu:precise")
const ubuntu2 = new docker.RemoteImage("ubuntu2", {
name: val
});
Previewing update (dev):
Type Name Plan Info
pulumi:pulumi:Stack pulumi-ts-test-dev
+- └─ docker:index:RemoteImage ubuntu2 replace [diff: ~name]
Resources:
+-1 to replace
2 unchanged
Do you want to perform this update? yes
Updating (dev):
Type Name Status
pulumi:pulumi:Stack pulumi-ts-test-dev
Resources:
3 unchanged
Duration: 2s
little-cartoon-10569
09/23/2024, 11:43 PMlittle-cartoon-10569
09/23/2024, 11:43 PMisDryRun
property.