Open zbuchheit opened 5 months ago
Hi @zbuchheit. Thanks for another high quality issue!
When investigating:
attachedDisks
resource is required to repro the bug, then it is in instance of resources clobbering each other.context here is the user has a boot disk included in the template, but a separate defined attachedDisk they want to define.
What happened?
While refreshing a created
InstanceFromTemplate
I experience a diff forattachedDisks
that I don't expect. After apulumi refresh
it will add an attachedDisks to the array in state, then on secondpulumi refresh
, will attempt to remove the attachedDisks entry/move it to be a[secret]
that part is unclear to me.Example
Code Example
Code Repro
```ts import * as gcp from "@pulumi/gcp"; const tpl = new gcp.compute.InstanceTemplate("zbuchheittpl", { machineType: "e2-medium", disks: [{ sourceImage: "debian-cloud/debian-11", diskSizeGb: 100, boot: true, }], guestAccelerators: [], networkInterfaces: [{ network: "default", }], }); const disk = new gcp.compute.Disk("zbuchheitdisk", { size: 100, type: "pd-ssd", zone: "us-west2-a", }); const tplInstanceFromTemplate = new gcp.compute.InstanceFromTemplate("zbuchheittpl", { zone: "us-west2-a", sourceInstanceTemplate: tpl.selfLinkUnique, }); const attachedDisks = new gcp.compute.AttachedDisk("attdiskzbuchheit", { project: "pulumi-ce-team", instance: tplInstanceFromTemplate.name, disk: disk.name, deviceName: "disk", mode: "READ_WRITE", zone: "us-west2-a", }); ```Steps to Reproduce
pulumi up
pulumi refresh
First Diff
``` pulumi:pulumi:Stack: (same) [urn=urn:pulumi:test1::gcp-ts::pulumi:pulumi:Stack::gcp-ts-test1] ~ gcp:compute/instanceTemplate:InstanceTemplate: (update) [id=projects/438338752289/global/instanceTemplates/zbuchheittpl-da0df03] [urn=urn:pulumi:test1::gcp-ts::gcp:compute/instanceTemplate:InstanceTemplate::zbuchheittpl] [provider=urn:pulumi:test1::gcp-ts::pulumi:providers:gcp::default_7_9_0::8585ecc0-ae00-44db-ae1b-f92ba78c38c1] --outputs:-- + guestAccelerators : [] ~ gcp:compute/disk:Disk: (update) [id=projects/438338752289/zones/us-west2-a/disks/zbuchheitdisk-68f3b10] [urn=urn:pulumi:test1::gcp-ts::gcp:compute/disk:Disk::zbuchheitdisk] [provider=urn:pulumi:test1::gcp-ts::pulumi:providers:gcp::default_7_9_0::8585ecc0-ae00-44db-ae1b-f92ba78c38c1] --outputs:-- + interface : "SCSI" + lastAttachTimestamp : "2024-04-22T15:04:05.147-07:00" ~ users : [ + [0]: "https://www.googleapis.com/compute/v1/projects/pulumi-ce-team/zones/us-west2-a/instances/zbuchheittpl-4d19506" ] ~ gcp:compute/instanceFromTemplate:InstanceFromTemplate: (update) [id=projects/438338752289/zones/us-west2-a/instances/zbuchheittpl-4d19506] [urn=urn:pulumi:test1::gcp-ts::gcp:compute/instanceFromTemplate:InstanceFromTemplate::zbuchheittpl] [provider=urn:pulumi:test1::gcp-ts::pulumi:providers:gcp::default_7_9_0::8585ecc0-ae00-44db-ae1b-f92ba78c38c1] --outputs:-- ~ attachedDisks : [ + [0]: { + deviceName : "disk" + diskEncryptionKeyRaw : [secret] + diskEncryptionKeySha256: "" + kmsKeySelfLink : "" + mode : "READ_WRITE" + source : "https://www.googleapis.com/compute/v1/projects/pulumi-ce-team/zones/us-west2-a/disks/zbuchheitdisk-68f3b10" } ] ```pulumi refresh
againSecond Diff
```sh pulumi:pulumi:Stack: (same) [urn=urn:pulumi:test1::gcp-ts::pulumi:pulumi:Stack::gcp-ts-test1] ~ gcp:compute/instanceFromTemplate:InstanceFromTemplate: (update) [id=projects/438338752289/zones/us-west2-a/instances/zbuchheittpl-4d19506] [urn=urn:pulumi:test1::gcp-ts::gcp:compute/instanceFromTemplate:InstanceFromTemplate::zbuchheittpl] [provider=urn:pulumi:test1::gcp-ts::pulumi:providers:gcp::default_7_9_0::8585ecc0-ae00-44db-ae1b-f92ba78c38c1] --outputs:-- - attachedDisks : [ - [0]: { - deviceName : "disk" - diskEncryptionKeyRaw : [secret] - diskEncryptionKeySha256: "" - kmsKeySelfLink : "" - mode : "READ_WRITE" - source : "https://www.googleapis.com/compute/v1/projects/pulumi-ce-team/zones/us-west2-a/disks/zbuchheitdisk-68f3b10" } ] + attachedDisks : [secret] ```Output of
pulumi about
Pulumi About
``` CLI Version 3.113.0 Go Version go1.22.2 Go Compiler gc Plugins NAME VERSION gcp 7.9.0 nodejs unknown Host OS darwin Version 14.2.1 Arch arm64 This project is written in nodejs: executable='/Users/zbuchheit/.nvm/versions/node/v18.17.1/bin/node' version='v18.17.1' Current Stack: zbuchheit-pulumi-corp/gcp-ts/test1 TYPE URN pulumi:pulumi:Stack urn:pulumi:test1::gcp-ts::pulumi:pulumi:Stack::gcp-ts-test1 pulumi:providers:gcp urn:pulumi:test1::gcp-ts::pulumi:providers:gcp::default_7_9_0 gcp:compute/disk:Disk urn:pulumi:test1::gcp-ts::gcp:compute/disk:Disk::zbuchheitdisk gcp:compute/instanceTemplate:InstanceTemplate urn:pulumi:test1::gcp-ts::gcp:compute/instanceTemplate:InstanceTemplate::zbuchheittpl gcp:compute/instanceFromTemplate:InstanceFromTemplate urn:pulumi:test1::gcp-ts::gcp:compute/instanceFromTemplate:InstanceFromTemplate::zbuchheittpl gcp:compute/attachedDisk:AttachedDisk urn:pulumi:test1::gcp-ts::gcp:compute/attachedDisk:AttachedDisk::attdiskzbuchheit Found no pending operations associated with test1 Backend Name pulumi.com URL https://app.pulumi.com/zbuchheit-pulumi-corp User zbuchheit-pulumi-corp Organizations zbuchheit-pulumi-corp Token type personal Dependencies: NAME VERSION @pulumi/gcp 7.9.0 @pulumi/pulumi 3.112.0 @types/node 18.19.31 Pulumi locates its logs in /var/folders/lh/l71cdh810xb33t0jc7qmt5_80000gn/T/ by default ```Additional context
This likely could be a multifaceted issue since it requires two
pulumi refresh
to fully witness the behavior. This in particular causes some anxiety with users as the diff displays it is removing an attachedDisk from the state. Which could cause a user to wrongfully assume it would try to recreate the attachedDisk.Once the diffs were accepted, it did not result in any actual changes during
pulumi up
but did cause a lot of hesitancy in the user that experienced the issue.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).