pulumi / pulumi-yaml

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

Stack References not working as expected #462

Closed MitchellGerdisch closed 9 months ago

MitchellGerdisch commented 1 year ago

What happened?

I have two stacks, stackA and stackB. (code below) StackB references a stack output from stackA and stackB uses it for a resource property. Initial updates work as expected - stackB consumes the stack output and uses it as expected in creating it’s resource. But if I change stackA so the output has a different value and run update on stackA and then update on stackB, stackB does not identify any changes needed.

Stack A Code:

name: stackA
runtime: yaml
description: A minimal Random Pulumi YAML program.
outputs:
  petnameAprefix: ${petnameA.prefix}
  petnameA: ${petnameA.id}
resources:
  petnameA:
    type: random:RandomPet
    properties:
      length: 3
      prefix: "petA"

Stack B Code:

name: stackB
runtime: yaml
description: A minimal Random Pulumi YAML program.
outputs:
  petnameB: ${petnameB.id}
variables:
  petnameAprefix: ${stack-a-reference.outputs["petnameAprefix"]}
resources:
  stack-a-reference:
    type: pulumi:pulumi:StackReference
    properties:
      name: ORG/stackA/dev
  petnameB:
    type: random:RandomPet
    properties:
      prefix: ${petnameAprefix}

Expected Behavior

StackB's stack reference to stackA should trigger an update in stackB when stackA's output is changed.

Steps to reproduce

  1. Launch stackA
  2. Launch stackB (be sure to set the stack-a-reference name property to match your environment)
  3. See that stackB's petname is using the prefix that was set in stackA and output as stack output.
  4. Modify stackA so the prefix property is different.
  5. Update stackA
  6. See that stackA's prefix output reflects the new value
  7. Update stackB
  8. See that stackB has no changed resources even though it should update the petname to reflect the new prefix read from stackA.

Output of pulumi about

CLI
Version 3.73.0 Go Version go1.20.5 Go Compiler gc

Plugins NAME VERSION pulumi unknown random unknown yaml unknown

Host
OS darwin Version 13.4.1 Arch x86_64

This project is written in yaml

TYPE URN pulumi:pulumi:Stack urn:pulumi:dev::stackB::pulumi:pulumi:Stack::stackB-dev pulumi:providers:pulumi urn:pulumi:dev::stackB::pulumi:providers:pulumi::default pulumi:pulumi:StackReference urn:pulumi:dev::stackB::pulumi:pulumi:StackReference::stack-a-reference pulumi:providers:random urn:pulumi:dev::stackB::pulumi:providers:random::default random:index/randomPet:RandomPet urn:pulumi:dev::stackB::random:index/randomPet:RandomPet::petnameB

Found no pending operations associated with dev

Backend
Name pulumi.com

No dependencies found

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).

justinvp commented 1 year ago

Thanks for opening the issue @MitchellGerdisch. I was able to reproduce this using your repro steps. Looking into it.