Write a pulumi program using the random provider to repro: "pulumi up fails on update when using resource outputs as inputs to other resources"
YAMLSure, here's a Pulumi program using the random provider to simulate the situation you've described. This program will first create a random string with an output, which we then use as an input to another resource.
However, note that this does not necessarily cause pulumi up to fail, as Pulumi is designed to handle such a situation where the output of one resource is used as the input of another. Failures could occur if there are cycles or dependencies that cannot be resolved, or code errors.
In our case, we are keeping this simple to illustrate resource-to-resource input-to-output relationship for you:
name: pulumi-random-error runtime: nodejs description: Reproduce update error for pulumi-random with resource outputs as inputs to others main: - name: randomString type: random:index/randomStringRandomString args length 10 special false - name: randomPet type: random:index/randomPet:RandomPet args: length: "{{.outputs.length}}" prefix: "{{.outputs.result}}" dependsOn: - randomString
Link to the relevant resources in the Pulumi Registry documentation:
In this program, a random string is created by using the
random:index/randomStringRandom
resource. The output of this operation (length
andresult
) are then used as inputs to therandom:index/randomPet:RandomPet
resource. TherandomPet
resource instance is declared to depend on therandomString
instance, thus ensuring the correct order of execution.pulumi up encounters an error during the update, it would likely be due to external circumstances, such as an issue with the random provider, rather than this input-output model.