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 displayed even when provider returns DIFF_NONE and empty detailed diff #15944

Closed
VenelinMartinov opened this issue Apr 15, 2024 · 0 comments · Fixed by #16024
Closed

Diff displayed even when provider returns DIFF_NONE and empty detailed diff #15944

VenelinMartinov opened this issue Apr 15, 2024 · 0 comments · Fixed by #16024
Assignees
Labels
area/cli UX of using the CLI (args, output, logs) kind/bug Some behavior is incorrect or out of spec resolution/fixed This issue was fixed

Comments

@VenelinMartinov
Copy link
Contributor

What happened?

related to pulumi/pulumi-gcp#1900

Looks like for some resources the engine displays a diff even when the provider returns DIFF_NONE.

@Frassle suggested it is an issue in the display logic. From the original issue:

For a reason I can't explain setting --protect to what matches in the code, will actually import the resource without the b/on the inputs and result in no diff after the import.

Fraser suggested this confirms it's the display logic going wrong here:

And it explains this as well! The engine always marks this as a SameStep and normally the display logic skips showing sames but if Protect changed it will display the step.

Example

Details in pulumi/pulumi-gcp#1900 (comment)

With GCP 7.18.0:

repro.sh:

#!/bin/bas
set -euxo pipefail

pulumi stack init test1 || True
pulumi up --stack test1 --yes
eval "$(pulumi stack output --shell)"

pulumi state delete $bindingUrn --yes --stack test1

cp import_template.json import.json
sed -i '' -e 's,<BUCKETID>,'"$bucketId"',g' import.json
pulumi import --file import.json --yes
pulumi preview --expect-no-changes

import_template.json:

{
    "resources": [
        {
            "type": "gcp:storage/bucketIAMBinding:BucketIAMBinding",
            "name": "objectAdminBinding",
            "id": "<BUCKETID> roles/storage.objectAdmin",
            "version": "7.18.0"
        }
    ]
}

index.ts:

import * as pulumi from "@pulumi/pulumi";
import * as gcp from "@pulumi/gcp";

// Create a GCP resource (Storage Bucket)
const bucket = new gcp.storage.Bucket("my-bucket", { location: "US" });

const binding = new gcp.storage.BucketIAMBinding("objectAdminBinding", {
  bucket: bucket.name,
  role: "roles/storage.objectAdmin",
  members: ["allAuthenticatedUsers"],
});

export const bucketId = bucket.id;
export const bindingUrn = binding.urn;

Notice that --expecto-no-change returns 0, running pulumi up returns no changes but preview still displays a diff:

Previewing update (test1)

View in Browser (Ctrl+O): https://app.pulumi.com/pulumi/gcp_bucket_import/test1/previews/74576f19-31c3-4a00-8cab-bf3dad5251f4

Loading policy packs...

     Type                             Name                     Plan     Info
     pulumi:pulumi:Stack              gcp_bucket_import-test1           
     └─ gcp:storage:BucketIAMBinding  objectAdminBinding                [diff: ~bucket,protect]

Policies:
    ✅ pulumi-internal-policies@v0.0.6

Resources:
    3 unchanged

Output of pulumi about

CLI
Version      3.111.1
Go Version   go1.22.1
Go Compiler  gc

Plugins
NAME    VERSION
gcp     7.18.0
nodejs  unknown

Host
OS       darwin
Version  14.1.1
Arch     arm64

This project is written in nodejs: executable='/opt/homebrew/bin/node' version='v21.6.1'

Current Stack: pulumi/gcp_bucket_import/test1

TYPE                                           URN
pulumi:pulumi:Stack                            urn:pulumi:test1::gcp_bucket_import::pulumi:pulumi:Stack::gcp_bucket_import-test1
pulumi:providers:gcp                           urn:pulumi:test1::gcp_bucket_import::pulumi:providers:gcp::default_7_18_0
gcp:storage/bucket:Bucket                      urn:pulumi:test1::gcp_bucket_import::gcp:storage/bucket:Bucket::my-bucket
gcp:storage/bucketIAMBinding:BucketIAMBinding  urn:pulumi:test1::gcp_bucket_import::gcp:storage/bucketIAMBinding:BucketIAMBinding::objectAdminBinding


Found no pending operations associated with test1

Backend
Name           pulumi.com
URL            https://app.pulumi.com/venelin-pulumi-corp
User           venelin-pulumi-corp
Organizations  venelin-pulumi-corp, demo, pulumi
Token type     personal

Dependencies:
NAME            VERSION
@types/node     18.19.31
@pulumi/gcp     7.18.0
@pulumi/pulumi  3.112.0

Pulumi locates its logs in /var/folders/82/nqnqw81s1h56l5nv940f9mq00000gn/T/ by default

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

@VenelinMartinov VenelinMartinov added kind/bug Some behavior is incorrect or out of spec needs-triage Needs attention from the triage team labels Apr 15, 2024
@justinvp justinvp added area/cli UX of using the CLI (args, output, logs) and removed needs-triage Needs attention from the triage team labels Apr 15, 2024
Frassle added a commit that referenced this issue Apr 22, 2024
github-merge-queue bot pushed a commit that referenced this issue May 2, 2024
<!--- 
Thanks so much for your contribution! If this is your first time
contributing, please ensure that you have read the
[CONTRIBUTING](https://github.com/pulumi/pulumi/blob/master/CONTRIBUTING.md)
documentation.
-->

# Description

<!--- Please include a summary of the change and which issue is fixed.
Please also include relevant motivation and context. -->

Fixes #15944.

## Checklist

- [x] I have run `make tidy` to update any new dependencies
- [x] I have run `make lint` to verify my code passes the lint check
  - [ ] I have formatted my code using `gofumpt`

<!--- Please provide details if the checkbox below is to be left
unchecked. -->
- [ ] I have added tests that prove my fix is effective or that my
feature works
<!--- 
User-facing changes require a CHANGELOG entry.
-->
- [ ] I have run `make changelog` and committed the
`changelog/pending/<file>` documenting my change
<!--
If the change(s) in this PR is a modification of an existing call to the
Pulumi Cloud,
then the service should honor older versions of the CLI where this
change would not exist.
You must then bump the API version in
/pkg/backend/httpstate/client/api.go, as well as add
it to the service.
-->
- [ ] Yes, there are changes in this PR that warrants bumping the Pulumi
Cloud API version
<!-- @pulumi employees: If yes, you must submit corresponding changes in
the service repo. -->

---------

Co-authored-by: Thomas Gummerer <t.gummerer@gmail.com>
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label May 2, 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 resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants