pulumi / pulumi-yaml

YAML language provider for Pulumi
Apache License 2.0
38 stars 11 forks source link

`pulumi up` fails on update when using resource outputs as inputs to other resources #466

Closed guineveresaenger closed 1 year ago

guineveresaenger commented 1 year ago

What happened?

A user reported https://github.com/pulumi/pulumi-docker/issues/685.

In summary, the user was attempting to use baseImageName, a resource output property on docker.Image, as the image field on docker.Container. Initial creation works fine; but when updating the Image resource, the Container.Image field is set to null.

We have verified that this behavior does not occur when using the NodeJS runtime.

When reproducing the issue on Docker, the GRPC logs for Check() which is where the error occurs look like this:

{
  "method": "/pulumirpc.ResourceProvider/Check",
  "request": {
    "urn": "urn:pulumi:yaml-dev::pulumi-yaml-image-update-issue::docker:index/container:Container::container",
    "olds": {
      "__defaults": [
        "attach",
        "containerReadRefreshTimeoutMilliseconds",
        "logs",
        "mustRun",
        "readOnly",
        "removeVolumes",
        "restart",
        "rm",
        "start",
        "stdinOpen",
        "tty",
        "wait",
        "waitTimeout"
      ],
      "attach": false,
      "containerReadRefreshTimeoutMilliseconds": 15000,
      "image": "pulumi-yaml-image-update-issue",
      "logs": false,
      "mustRun": true,
      "name": "pulumi-yaml-image-update-issue",
      "ports": [
        {
          "__defaults": [
            "protocol"
          ],
          "external": 3000,
          "internal": 3000,
          "ip": "127.0.0.1",
          "protocol": "tcp"
        }
      ],
      "readOnly": false,
      "removeVolumes": true,
      "restart": "no",
      "rm": false,
      "start": true,
      "stdinOpen": false,
      "tty": false,
      "wait": false,
      "waitTimeout": 60
    },
    "news": {
      "image": null,
      "name": "pulumi-yaml-image-update-issue",
      "ports": [
        {
          "external": 3000,
          "internal": 3000,
          "ip": "127.0.0.1"
        }
      ]
    },
    "randomSeed": "Yr3RNYvDLEoTUuzsI4U5+B6DIQhLXtLzS/8tBY2sOqc="
  },
  "response": {
    "inputs": {
      "__defaults": [
        "attach",
        "containerReadRefreshTimeoutMilliseconds",
        "logs",
        "mustRun",
        "readOnly",
        "removeVolumes",
        "restart",
        "rm",
        "start",
        "stdinOpen",
        "tty",
        "wait",
        "waitTimeout"
      ],
      "attach": false,
      "containerReadRefreshTimeoutMilliseconds": 15000,
      "logs": false,
      "mustRun": true,
      "name": "pulumi-yaml-image-update-issue",
      "ports": [
        {
          "__defaults": [
            "protocol"
          ],
          "external": 3000,
          "internal": 3000,
          "ip": "127.0.0.1",
          "protocol": "tcp"
        }
      ],
      "readOnly": false,
      "removeVolumes": true,
      "restart": "no",
      "rm": false,
      "start": true,
      "stdinOpen": false,
      "tty": false,
      "wait": false,
      "waitTimeout": 60
    },
    "failures": [
      {
        "reason": "Missing required argument. The argument \"image\" is required, but no definition was found.. Examine values at 'container.image'."
      }
    ]
  },
  "metadata": {
    "kind": "resource",
    "mode": "client",
    "name": "docker"
  }
}

Expected Behavior

The dependent resource (docker.Container) should have access to docker.Image's output field.

Steps to reproduce

The user provided a reproduction of this issue.

Output of pulumi about

n/a - yaml does not tell you the current version. Using latest pulumi.

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction. To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

nstires-ctgx commented 1 year ago

Is there a work-around for this? I tried downgrading to v3.75.0 without luck.

iwahbe commented 1 year ago

@nstires-ctgx was this working for you at some earlier version, either of pulumi-docker or pulumi?

nstires-ctgx commented 1 year ago

I looked at the stack history, looks like last update that worked was on 3.76.0. The resource types that were failing with the corresponding outputs are as follows:

type: gcp:cloudfunctions:Function
output: httpsTriggerUrl

type: gcp:vpcaccess:Connector
output: id
dixler commented 1 year ago

It seems that it's failing during preview as I can bypass the errors with --skip-preview.