Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diff shows same properties being updated and deleted diff: -tags,tagsAll~tags,tagsAll #16144

Open
lukehoban opened this issue May 8, 2024 · 1 comment
Labels
area/cli UX of using the CLI (args, output, logs) kind/bug Some behavior is incorrect or out of spec

Comments

@lukehoban
Copy link
Member

lukehoban commented May 8, 2024

Deploy this with pulumi up:

import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
import * as awsx from "@pulumi/awsx";

// Create an AWS resource (S3 Bucket)
const bucket = new aws.s3.BucketV2("my-bucket");

// Export the name of the bucket
export const bucketName = bucket.id;

Then modify the bucket in AWS Console to add a tag foo: bar.

Then run pulumi refresh and accept the results.

Then run pulumi up.

The result is this:

Previewing update (dev)

View in Browser (Ctrl+O): https://app.pulumi.com/luke-pulumi-corp/awsbucketrefresh2/dev/previews/34b6cfe4-72cd-4ada-89b6-34d391f79918

     Type                 Name                   Plan       Info
     pulumi:pulumi:Stack  awsbucketrefresh2-dev             
 ~   └─ aws:s3:BucketV2   my-bucket              update     [diff: -tags,tagsAll~tags,tagsAll]

Resources:
    ~ 1 to update
    1 unchanged

Note that tags and tagsAll show as both updated and deleted. This is misleading/incorrect.

The actual detailed diff that is returned from the AWS provider for this case is:

map[tags:{update false} tags.foo:{delete false} tagsAll:{update false} tagsAll.foo:{delete false}] 

Notice that there are actually diffs at different levels - tags is being updated, and tags.foo is being deleted. Even that doesn't seem necessarily correct? But regardless, rendering it as we do currently is even more wrong/misleading. We should fix at one/both of the CLI diff display and/or the detailed diff constructed by AWS / Terraform Bridge (with clear guidance on what is "legal" to produce in a diff such that whatever is produced will be displayed cleanly and correctly by the diff rendering logic).

@lukehoban lukehoban added the needs-triage Needs attention from the triage team label May 8, 2024
@lukehoban
Copy link
Member Author

Also arguably even more confusing display in the diff display:

  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:dev::awsbucketrefresh2::pulumi:pulumi:Stack::awsbucketrefresh2-dev]
    ~ aws:s3/bucketV2:BucketV2: (update)
        [id=my-bucket-d9057d9]
        [urn=urn:pulumi:dev::awsbucketrefresh2::aws:s3/bucketV2:BucketV2::my-bucket]
        [provider=urn:pulumi:dev::awsbucketrefresh2::pulumi:providers:aws::default_6_33_1::7b86a3ea-729d-4614-aa0d-88713db03c1e]
      - tags   : {
          - foo: "bar"
        }
      - tags   : {
          - foo: "bar"
        }
      - tagsAll: {
          - foo: "bar"
        }
      - tagsAll: {
          - foo: "bar"
        }

@justinvp justinvp added kind/bug Some behavior is incorrect or out of spec area/cli UX of using the CLI (args, output, logs) and removed needs-triage Needs attention from the triage team labels May 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli UX of using the CLI (args, output, logs) kind/bug Some behavior is incorrect or out of spec
Projects
None yet
Development

No branches or pull requests

2 participants