I have a stack that has thousands of resources. Re...
# general
a
I have a stack that has thousands of resources. Recently, Pulumi decided that many of them need to be replaced because the
name
changed, but in reality, nothing has changed. Why is this, and how can I fix it?
For example, here is one resource (Typescript):
Copy code
import * as gcp from '@pulumi/gcp';

export const certificateMap = new gcp.certificatemanager.CertificateMap('certificate-map', {
  project: 'MY_PROJECT',
});
Here is the generated diff:
Copy code
{
            "op": "replace",
            "urn": "urn:pulumi:live::pulumi-live::gcp:certificatemanager/certificateMap:CertificateMap::certificate-map",
            "provider": "urn:pulumi:live::pulumi-live::pulumi:providers:gcp::default_6_54_0::373d8534-dfe3-4d86-9ff8-09bd6b2b6dfa",
            "oldState": {
                "urn": "urn:pulumi:live::pulumi-live::gcp:certificatemanager/certificateMap:CertificateMap::certificate-map",
                "custom": true,
                "delete": true,
                "id": "projects/MY_PROJECT/locations/global/certificateMaps/certificate-map-527fd62",
                "type": "gcp:certificatemanager/certificateMap:CertificateMap",
                "inputs": {
                    "__defaults": [
                        "name"
                    ],
                    "project": "MY_PROJECT"
                },
                "outputs": {
                    "__meta": "{\"e2bfb730-ecaa-11e6-8f88-34363bc7c4c0\":{\"create\":1200000000000,\"delete\":1200000000000,\"update\":1200000000000}}",
                    "createTime": "2023-04-24T23:14:15.759396870Z",
                    "description": "",
                    "gclbTargets": [
                        {
                            "ipConfigs": [
                                {
                                    "ipAddress": "MY_IP",
                                    "ports": [
                                        443
                                    ]
                                }
                            ],
                            "targetHttpsProxy": "//compute.googleapis.com/projects/MY_PROJECT_ID/global/targetHttpsProxies/target-https-proxy-static-273e98c",
                            "targetSslProxy": ""
                        }
                    ],
                    "id": "projects/MY_PROJECT/locations/global/certificateMaps/certificate-map-527fd62",
                    "labels": {},
                    "name": "certificate-map-527fd62",
                    "project": "MY_PROJECT",
                    "updateTime": "2023-04-24T23:14:16.247271473Z"
                },
                "parent": "urn:pulumi:live::pulumi-live::pulumi:pulumi:Stack::pulumi-live-live",
                "provider": "urn:pulumi:live::pulumi-live::pulumi:providers:gcp::default_6_54_0::373d8534-dfe3-4d86-9ff8-09bd6b2b6dfa",
                "propertyDependencies": {
                    "project": null
                },
                "created": "0001-01-01T00:00:00Z",
                "modified": "0001-01-01T00:00:00Z"
            },
            "newState": {
                "urn": "urn:pulumi:live::pulumi-live::gcp:certificatemanager/certificateMap:CertificateMap::certificate-map",
                "custom": true,
                "type": "gcp:certificatemanager/certificateMap:CertificateMap",
                "inputs": {
                    "__defaults": [
                        "name"
                    ],
                    "name": "certificate-map-b4ecd83",
                    "project": "MY_PROJECT"
                },
                "outputs": {
                    "id": "",
                    "name": "certificate-map-b4ecd83",
                    "project": "MY_PROJECT"
                },
                "parent": "urn:pulumi:live::pulumi-live::pulumi:pulumi:Stack::pulumi-live-live",
                "provider": "urn:pulumi:live::pulumi-live::pulumi:providers:gcp::default_6_54_0::373d8534-dfe3-4d86-9ff8-09bd6b2b6dfa",
                "propertyDependencies": {
                    "project": null
                },
                "created": "0001-01-01T00:00:00Z",
                "modified": "0001-01-01T00:00:00Z"
            },
            "diffReasons": [
                "name"
            ],
            "replaceReasons": [
                "name"
            ],
            "detailedDiff": {
                "name": {
                    "kind": "update-replace",
                    "inputDiff": false
                }
            }
        },
b
whats the output of
pulumi about
?
a
Copy code
CLI
Version      3.67.0
Go Version   go1.20.4
Go Compiler  gc

Plugins
NAME        VERSION
cloudflare  5.0.0
gcp         6.54.0
nodejs      unknown

Host
OS       ubuntu
Version  20.04
Arch     x86_64

This project is written in nodejs: executable='/home/MY_USER/.nvm/versions/node/v18.12.1/bin/node' version='v18.12.1'
I tried v3.68.0 with the same results.
v3.66.0 had a bug that was subsequently fixed, so I couldn't test with that.
If I litter my code with
{ ignoreChanges: ['name'] }
, it works, but I shouldn't have to, since nothing has changed.
b
Hey @aloof-leather-66267, take a look at this thread, same exact issue: https://pulumi-community.slack.com/archives/C84L4E3N1/p1684762071852299 tl;dr: there was a bug introduced in
3.66.0
(until
3.68
), defaults get deleted from the stack when using a bugged version alongside
-t
, restore a stack checkpoint fixes it (look for the latest stack that stil contains the defaults)
a
Thank you! Looks like my issue was the same. I updated Pulumi CLI and restored a backup, and it looks like the issue went away.