pulumi / pulumi-gcp

A Google Cloud Platform (GCP) Pulumi resource package, providing multi-language access to GCP
Apache License 2.0
182 stars 52 forks source link

Provider updated, resource replace (unique non-recreatable type gcp.GlobalAddress) #673

Open hermanbanken opened 2 years ago

hermanbanken commented 2 years ago

Hello!

Issue details

We have gcp.GlobalAddress resources which appear to be delete-replaced when running pulumi up after a NPM module update.

Pulumi version: ```bash -> % pulumi version v3.15.0 ``` Plugins installed: inside the details-fold. ``` -> % pulumi plugin ls NAME KIND VERSION SIZE INSTALLED LAST USED docker resource 3.1.0 40 MB 1 month ago 1 month ago docker resource 2.10.0 39 MB 1 month ago 1 month ago docker resource 2.3.0 45 MB 1 year ago 1 year ago docker resource 2.2.3 40 MB 1 year ago 1 year ago docker resource 2.2.0 40 MB 1 year ago 1 year ago docker resource 2.1.0 40 MB 1 year ago 1 year ago docker resource 1.5.0 40 MB 2 years ago 2 years ago docker resource 1.1.0 40 MB 2 years ago 2 years ago gcp resource 5.25.0 116 MB 23 hours ago 20 hours ago gcp resource 5.18.0 111 MB 1 month ago 1 month ago gcp resource 5.1.0 103 MB 5 months ago 5 months ago gcp resource 4.10.0 103 MB 6 months ago 6 months ago gcp resource 4.5.2 104 MB 10 months ago 9 months ago gcp resource 3.25.0 101 MB 1 year ago 1 year ago gcp resource 3.13.0 93 MB 1 year ago 1 year ago gcp resource 3.6.0 90 MB 1 year ago 1 year ago gcp resource 3.3.0 88 MB 1 year ago 1 year ago gcp resource 2.13.0 86 MB 1 year ago 1 year ago gcp resource 2.12.0 86 MB 2 years ago 2 years ago gcp resource 2.8.0 81 MB 1 year ago 1 year ago gcp resource 2.7.0 80 MB 2 years ago 2 years ago gcp resource 2.2.0 79 MB 2 years ago 2 years ago gcp resource 2.1.0 78 MB 2 years ago 2 years ago gcp resource 1.9.0 79 MB 2 years ago 2 years ago gcp resource 1.7.0 79 MB 2 years ago 2 years ago gcp resource 1.6.0 89 MB 2 years ago 2 years ago gcp resource 1.4.1 88 MB 2 years ago 2 years ago github resource 4.6.0 41 MB 23 hours ago 23 hours ago github resource 2.2.0 46 MB 11 months ago 11 months ago kubernetes resource 3.8.2 76 MB 23 hours ago 23 hours ago kubernetes resource 3.7.0 75 MB 1 month ago 1 month ago kubernetes resource 2.6.3 72 MB 11 months ago 11 months ago kubernetes resource 2.6.1 68 MB 1 year ago 1 year ago kubernetes resource 2.4.0 60 MB 1 year ago 1 year ago kubernetes resource 2.2.0 52 MB 1 year ago 1 year ago kubernetes resource 2.0.0 52 MB 1 year ago 1 year ago kubernetes resource 1.6.0 49 MB 2 years ago 2 years ago kubernetes resource 1.5.6 49 MB 2 years ago 2 years ago kubernetes resource 1.4.4 49 MB 2 years ago 2 years ago kubernetes resource 1.4.1 49 MB 2 years ago 2 years ago kubernetes resource 1.3.4 49 MB 2 years ago 2 years ago kubernetes resource 1.3.1 49 MB 2 years ago 2 years ago kubernetes resource 1.2.3 47 MB 2 years ago 2 years ago random resource 4.3.1 32 MB 23 hours ago 23 hours ago random resource 4.2.0 30 MB 1 month ago 1 month ago random resource 2.5.0 40 MB 1 month ago 1 month ago random resource 2.4.0 43 MB 11 months ago 10 months ago random resource 2.3.1 42 MB 1 year ago 1 year ago random resource 2.2.0 39 MB 1 year ago 1 year ago random resource 2.1.1 37 MB 1 year ago 1 year ago random resource 2.1.0 38 MB 1 year ago 1 year ago ```

Steps to reproduce

  1. Create global addresses using GCP provider 4.5.2
  2. Run pulumi up
  3. Update GCP provider to version 5.25.0
  4. Run pulumi up

Expected: no updates Actual: delete-replaces proposed

Note

Does delete-replace ACTUALLY delete the resources? What would happen / how to identify if Pulumi will only update the state in the stack? Under no circumstances may our (production) gcp.GlobalAddress be deleted (because this would assign a new IP address from the Google External IPv4 pool).

I have added protect: true, but I'm not sure if this will not complain and fail. I'm really reluctant to try to apply the update (even on the dev environment) due to the hassle involved if it would actually replace the IP.

Note that as a user of Pulumi I really do not care about the plugin version, and mostly care about my resources not being deleted when I update the tools... the tools are just a means to an end.

I'm not sure how this relates to (old) issues like pulumi/pulumi#2753, pulumi/pulumi#2829 and https://github.com/pulumi/pulumi-eks/issues/207, because we're using Pulumi 3.15 and it is 2021 already.

pulumi preview -s redacted --diff
Previewing update (redacted-gcp-project):
  pulumi:pulumi:Stack: (same)
    [urn=urn:pulumi:redacted-gcp-project::hue/gcp-project::pulumi:pulumi:Stack::hue/gcp-project-redacted-gcp-project]
    ~ pulumi:providers:gcp: (update)
        [id=81761976-8176-4c05-ac8a-dfbc0e357bef]
        [urn=urn:pulumi:redacted-gcp-project::hue/gcp-project::pulumi:providers:gcp::gcp]
        project: "redacted"
      ~ version: "4.5.2" => "5.25.0"
    +-gcp:compute/globalAddress:GlobalAddress: (replace) πŸ”’
        [id=projects/redacted/global/addresses/mcl-global-services]
        [urn=urn:pulumi:redacted-gcp-project::hue/gcp-project::gcp:compute/globalAddress:GlobalAddress::mcl-global-services]
        [provider: urn:pulumi:redacted-gcp-project::hue/gcp-project::pulumi:providers:gcp::default_4_5_2::5770716d-dca5-400d-a4d4-5c70a77280ae => urn:pulumi:redacted-gcp-project::hue/gcp-project::pulumi:providers:gcp::default_5_25_0::output<string>]
        address          : "redacted"
        addressType      : "EXTERNAL"
        creationTimestamp: "2021-01-11T02:25:12.583-08:00"
        id               : "projects/redacted/global/addresses/mcl-global-services"
        labelFingerprint : "42WmSpB8rSM="
        name             : "mcl-global-services"
        prefixLength     : 0
        project          : "redacted"
        selfLink         : "https://www.googleapis.com/compute/v1/projects/redacted/global/addresses/mcl-global-services"
    +-gcp:compute/globalAddress:GlobalAddress: (replace) πŸ”’
        [id=projects/redacted/global/addresses/mcl-global-services]
        [urn=urn:pulumi:redacted-gcp-project::hue/gcp-project::gcp:compute/globalAddress:GlobalAddress::mcl-global-ws]
        [provider: urn:pulumi:redacted-gcp-project::hue/gcp-project::pulumi:providers:gcp::default_4_5_2::5770716d-dca5-400d-a4d4-5c70a77280ae => urn:pulumi:redacted-gcp-project::hue/gcp-project::pulumi:providers:gcp::default_5_25_0::output<string>]
        address          : "redacted"
        addressType      : "EXTERNAL"
        creationTimestamp: "2021-01-11T02:25:12.583-08:00"
        id               : "projects/redacted/global/addresses/mcl-global-services"
        labelFingerprint : "42WmSpB8rSM="
        name             : "mcl-global-services"
        prefixLength     : 0
        project          : "redacted"
        selfLink         : "https://www.googleapis.com/compute/v1/projects/redacted/global/addresses/mcl-global-services"

[... redacted ...]

Resources:
    + 9 to create
    ~ 1 to update
    - 6 to delete
    +-2 to replace
    = 41 to import
    59 changes. 116 unchanged
hermanbanken commented 2 years ago

I've taken the leap to actually proceed, and then this weird sequence of events happens:

Do you want to perform this update? yes
Updating (redacted-gcp-project):
     Type                          Name                                 Status                    Info
     pulumi:pulumi:Stack           hue/gcp-project-redacted-gcp-project running...
 ~   β”œβ”€ pulumi:providers:gcp       gcp                                  updated                   [diff: ~version]
 =>  β”œβ”€ gcp:compute:GlobalAddress  mcl-global-ws                        importing replacement...
 =>  └─ gcp:compute:GlobalAddress  mcl-global-services                  importing replacement...

Then after a while:

Do you want to perform this update? yes
Updating (redacted-gcp-project):
     Type                                Name                                 Status                   Info
     pulumi:pulumi:Stack                 hue/gcp-project-redacted-gcp-project running...
 ~   β”œβ”€ pulumi:providers:gcp             gcp                                  updated                  [diff: ~version]
 =>  β”œβ”€ gcp:compute:GlobalAddress        mcl-global-ws                        imported replacement
 =>  β”œβ”€ gcp:compute:GlobalAddress        mcl-global-services                  imported replacement

Then after a while:

Do you want to perform this update? yes
Updating (redacted-gcp-project):
     Type                                Name                                  Status        Info
     pulumi:pulumi:Stack                 hue/gcp-project-redacted-gcp-project  running..
 ~   β”œβ”€ pulumi:providers:gcp             gcp                                   updated       [diff: ~version]
 +-  β”œβ”€ gcp:compute:GlobalAddress        mcl-global-ws                         replaced      [diff: ~protect,provider]
 +-  β”œβ”€ gcp:compute:GlobalAddress        mcl-global-services                   replaced      [diff: ~protect,provider]

Finally:

Resources:
    + 9 created
    ~ 1 updated
    - 3 deleted
    +-2 replaced
    = 41 imported
    56 changes. 116 unchanged

Duration: 5m20s

Then when I rerun:

pulumi up -s redacted-gcp-project
Previewing update (redacted-gcp-project):
     Type                          Name                                  Plan        Info
     pulumi:pulumi:Stack           hue/gcp-project-redacted-gcp-project  running     
     └─ gcp:compute:GlobalAddress  mcl-global-services                   delete      completing deletion from previous update

While after running, it does NOT delete the resource... Huh?

praveenperera commented 2 years ago

I am also seeing this. After running pulumi refresh -y after about 30 mins after completion the problem seems to go away.

My GCP cluster was created with:

                    "nodeConfig": {
                        "__defaults": [
                            "spot"
                        ],
                        "preemptible": true,

And on pulumi up it wants to change it to:

                    "nodeConfig": {
                        "__defaults": [],
                        "preemptible": false,

Seems like a bug on initial cluster creation as GCP doesn't have a "spot" setting.

After running pulumi refresh 30 mins later. It no longer wants to replace everything and the values are:

                    "nodeConfig": {
                        "__defaults": [
                            "preemptible",
                            "spot"
                        ],
                        "preemptible": true,