pulumi / pulumi-gcp

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

Empty indexConfig in gcp.firestore.Field shows changes on every update #2166

Closed wvanderdeijl closed 2 months ago

wvanderdeijl commented 3 months ago

Describe what happened

When you do not want any indexes that are normally created for a field, you should specify an empty indexConfig block for a gcp.firestore.Field resource. Also see the Firestore Field Timestamp example at https://www.pulumi.com/registry/packages/gcp/api-docs/firestore/field/#firestore-field-timestamp

This works as expected when creating the resource and the GCP console shows that the normal single field indices are disabled. But every subsequent pulumi up or pulumi preview shows that pulumi want to update the resource again to non indexConfig. Performing the actual update doesn't change anything in the GCP console, but every consequent pulumi up or pulumi preview keeps showing the planned change.

Sample program

new gcp.firestore.Field(`noidx`, {
    project: 'pam1-wao',
    collection: 'my-collection',
    database: '(default)',
    field: 'field',
    indexConfig: {},
});

Log output

pulumi preview --diff

Previewing update (***):
  pulumi:pulumi:Stack: (same)
    [urn=***]
    ~ gcp:firestore/field:Field: (update)
        [id=projects/***/databases/(default)/collectionGroups/my-collection/fields/field]
        [urn=***]
        [provider=urn:***:gcp::default_7_30_1::c15f77d9-100c-4b41-824b-3af65a608275]
      + indexConfig: {
        }

Affected Resource(s)

gcp.firestore.Field

Output of pulumi about

n/a

Additional context

We did not have this issue with @pulumi/gcp version 6.67.0. We have not tested any of the versions between 6.67.0 and 7.30.1

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

wvanderdeijl commented 3 months ago

Should this be included in #1936 ?

wvanderdeijl commented 3 months ago

This permadiff does not happen when there are actual indices defined, for example:

    indexConfig: {
        indexes: [{ queryScope: 'COLLECTION', order: 'ASCENDING' }],
    },

Specifying an explicit empty indexes array does not fix the issue and still gives a permadiff:

    indexConfig: {
        indexes: [],
    },
VenelinMartinov commented 2 months ago

Thanks for reporting this one too @wvanderdeijl!

We've got a fix incoming in https://github.com/pulumi/pulumi-gcp/pull/2182

pulumi-bot commented 2 months ago

This issue has been addressed in PR #2182 and shipped in release v7.31.0.